Con l'aiuto della documentazione di Growl sul supporto AppleScript e una breve discussione con Bart Arondson e Elliot B nei commenti sulla domanda che ho ricevuto con il seguente AppleScript.
Ho salvato questo script come agente di applicazione che puoi aggiungere ai tuoi elementi di accesso in Preferenze di sistema → Utenti e amp; Gruppi → Elementi di accesso .
Fondamentalmente, questa applicazione funziona rilevando se si accede a un eseguibile univoco relativo all'uso della videocamera. Ogni volta che si accede all'eseguibile, l'applicazione ne informerà su Growl:
Scarica
È importante sapere che questo script monitora l'accesso all'eseguibile ...
/System/Library/Frameworks/CoreMediaIO.framework/Versions/A/Resources/VDC.plugin/Contents/MacOS/VDC
Script completo
-- check if growl is running in order to avoid the "Choose Application" dialog
tell application "System Events"
set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell
-- store time of last iSight access
global lastopened
set lastopened to do shell script "ls -lu /System/Library/Frameworks/CoreMediaIO.framework/Versions/A/Resources/VDC.plugin/Contents/MacOS/VDC | awk '{print $6,$7,$8}'"
-- make the application ready for use with growl
if isRunning then
tell application id "com.Growl.GrowlHelperApp"
-- make a list of all the notification types that this script will ever send
set the allNotificationsList to ¬
{"iSight access monitor"}
-- register the script with growl
register as application ¬
"iSight access monitor" all notifications allNotificationsList ¬
default notifications allNotificationsList ¬
icon of application "FaceTime"
-- send the first notification right after the application is started
notify with name ¬
"iSight access monitor" title ¬
"iSight access monitor" description ¬
"last iSight access:
" & lastopened application name "iSight access monitor"
end tell
end if
-- monitoring routine: checks every 10s if the VDC executable has been accessed
on idle
tell application id "com.Growl.GrowlHelperApp"
set newopen to do shell script "ls -lu /System/Library/Frameworks/CoreMediaIO.framework/Versions/A/Resources/VDC.plugin/Contents/MacOS/VDC | awk '{print $6,$7,$8}'"
if (newopen is not equal to lastopened) then
notify with name ¬
"iSight access monitor" title ¬
"iSight access monitor" description ¬
"new iSight access:
" & newopen application name "iSight access monitor"
set lastopened to newopen
end if
end tell
return 10 -- interval in seconds
end idle