Intento ejecutar el siguiente script a través de LaunchAgent:
on run argv
set current_path to POSIX path of ((path to me as text) & "::")
set common to load script (current_path & "common.scpt")
set screenSharingApp to "Screen Sharing"
try
if application screenSharingApp is running then do shell script "killall '" & screenSharingApp & "'"
end try
repeat until application screenSharingApp is not running
delay 0.1
end repeat
tell application screenSharingApp
launch
activate
end tell
end run
Pero siempre me sale este error: error de ejecución: Screen Sharing got an error: Application isn't running. (-600)
Si ejecuto la misma secuencia de comandos a través del Editor de secuencias de comandos o la Terminal está funcionando bien.
¿Qué puede ser? Por que no funciona?
Mi plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.myapp</string>
<key>StandardErrorPath</key>
<string>/Users/user1/Desktop/stderr.log</string>
<key>StandardOutPath</key>
<string>/Users/user1/Desktop/stdout.log</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>/Users/user1/Desktop/1.scpt</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>300</integer>
</dict>
</plist>