- Registriert
- 18.07.09
- Beiträge
- 324
Hi, ich versuche grade ein Script für die App Selfcontrol via cronjobs starten zu lassen. Im ApplescriptEditor läuft es perfekt, aus dem Terminal heraus lässt es sich auch problemlos starten. Nur wenn ich das ganze über eine crontab laufen lasse, will das ganze nicht richtig funktionieren. Es öffnet zwar die Anwendung selfControl, aber startet nicht die Ausführung.
Hat jemand eine Idee, woran das liegen könnte?
das script starte ich mit:
der cronjob entsprechend:
Hier das Script ausm Netz, leicht abgeändert (und ja, mir ist bewusst, wie unsicher Klartext-Passworte sind):
Hat jemand eine Idee, woran das liegen könnte?
das script starte ich mit:
Code:
osascript /Users/thomas/Documents/Scripte/selfControl.scpt 45
der cronjob entsprechend:
Code:
#min hour mday month wday operation
0 8 * * * osascript /Users/thomas/Documents/Scripte/selfControl.scpt 45
Hier das Script ausm Netz, leicht abgeändert (und ja, mir ist bewusst, wie unsicher Klartext-Passworte sind):
Code:
[B]on[/B] [COLOR=#103FFB][B]run[/B][/COLOR] [COLOR=#518E16]argv[/COLOR] [B]set[/B] [COLOR=#518e16]defaultTime[/COLOR] [B]to[/B] 15
[B]try[/B]
[B]set[/B] [COLOR=#518e16]myTime[/COLOR] [B]to[/B] [COLOR=#103ffb][I]item[/I][/COLOR] 1 [B]of[/B] [COLOR=#518e16]argv[/COLOR] [B]as[/B] [COLOR=#103ffb][I]number[/I][/COLOR]
[B]on[/B] [B]error[/B]
[COLOR=#518E16][COLOR=#000000] [B]set[/B] [/COLOR]myTime[COLOR=#000000] [B]to[/B] [/COLOR]defaultTime[/COLOR]
[B]end[/B] [B]try[/B]
[B]set[/B] [COLOR=#518e16]myPass[/COLOR] [B]to[/B] "******"
[B]tell[/B] [COLOR=#103ffb][I]application[/I][/COLOR] "SelfControl" [B]to[/B] [COLOR=#103ffb][B]activate[/B][/COLOR]
[B]tell[/B] [COLOR=#103ffb][I]application[/I][/COLOR] "System Events"
[B]tell[/B] [COLOR=#103ffb][I]process[/I][/COLOR] "SelfControl"
[B]tell[/B] [COLOR=#103ffb][I]slider[/I][/COLOR] [B]of[/B] [COLOR=#103ffb][I]window[/I][/COLOR] "SelfControl" [B]to[/B] [B]set[/B] [COLOR=#8039d8]value[/COLOR] [B]to[/B] [COLOR=#518e16]myTime[/COLOR]
[COLOR=#103ffb][B]click[/B][/COLOR] [COLOR=#103ffb][I]button[/I][/COLOR] "Start" [B]of[/B] [COLOR=#103ffb][I]window[/I][/COLOR] "SelfControl"
[B]end[/B] [B]tell[/B]
[B]tell[/B] [COLOR=#103ffb][I]window[/I][/COLOR] 1 [B]of[/B] [COLOR=#103ffb][I]process[/I][/COLOR] "SecurityAgent"
[B]with[/B] [B]timeout[/B] [B]of[/B] 15 [COLOR=#103ffb][I]seconds[/I][/COLOR]
[B]repeat[/B]
[B]set[/B] [COLOR=#518e16]tryAgain[/COLOR] [B]to[/B] [COLOR=#5d3690]false[/COLOR]
[B]try[/B]
[B]set[/B] [COLOR=#8039d8]value[/COLOR] [B]of[/B] [COLOR=#103ffb][I]text field[/I][/COLOR] 2 [B]of[/B] [COLOR=#103ffb][I]scroll area[/I][/COLOR] 1 [B]of[/B] [COLOR=#103ffb][I]group[/I][/COLOR] 1 [B]to[/B] [COLOR=#518e16]myPass[/COLOR]
[B]on[/B] [B]error[/B]
[COLOR=#0936bb][B]delay[/B][/COLOR] 1
[B]set[/B] [COLOR=#518e16]tryAgain[/COLOR] [B]to[/B] [COLOR=#5d3690]true[/COLOR]
[B]end[/B] [B]try[/B]
[B]if[/B] [B]not[/B] [COLOR=#518e16]tryAgain[/COLOR] [B]then[/B] [B]exit[/B] [B]repeat[/B]
[B]end[/B] [B]repeat[/B]
[COLOR=#103FFB][B]click[/B][I]button[/I][COLOR=#000000] 2 [B]of[/B] [/COLOR][I]group[/I][COLOR=#000000] 2[/COLOR][/COLOR]
[B]end[/B] [B]timeout[/B]
[B]end[/B] [B]tell[/B]
[B]end[/B] [B]tell[/B]
[B]end[/B] [COLOR=#103FFB][B]run[/B][/COLOR]
Zuletzt bearbeitet: