Con la ayuda de la documentación de Growl sobre el soporte de AppleScript y un poco de discusión con Bart Arondson y Elliot B en los comentarios sobre la pregunta en la que he venido con el siguiente AppleScript.
He guardado este script como un agente de aplicaciones que puede agregar a sus elementos de inicio de sesión en Preferencias del sistema → Usuarios & Grupos → Elementos de inicio de sesión .
Básicamente, esta aplicación funciona al detectar si se está accediendo a un ejecutable único relacionado con el uso de la cámara. Siempre que se acceda al ejecutable, la aplicación lo notificará a Growl:
1
Esimportantesaberqueestescriptsupervisaelaccesoalejecutable...
/System/Library/Frameworks/CoreMediaIO.framework/Versions/A/Resources/VDC.plugin/Contents/MacOS/VDC
Scriptcompleto
--checkifgrowlisrunninginordertoavoidthe"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