Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

MacOs 10.8.2 I have 2 applescripts shown below. They are arranged in one shell script to run one after another by using osascript (just to simplify the example). Everything works fine when starting shell script form the console. However if the same script scheduled in crontab I get an error from the second script.(First run just fine)

STAR-RECORDING SCRIPT

tell application "QuickTime Player"
    activate
    new screen recording 1
    start document 1
end tell

STOP-RECORDING SCRIPT

tell application "QuickTime Player"
    activate
    document "Screen Recording" stop
end tell

THE SHELL SCRIPT

osascript start-recording.scpt
osascript stop-recording.scpt

Additional info

  1. There is only one user loged in the system. Cronjob is executed for him as well. I can visually confirm that recording was started after first scipt is executed

  2. The error is saying something like this: Quick time cant get document Screen recording. error -1728

  3. the crontab row is

     10 18 * * * /Users/usr1/test.sh
    

    where test.sh is the script running both applescripts as shown above

share|improve this question
    
Which QuickTime Player should the cron job address if several users are logging in at the time and all of them are using QT? –  patrix Jan 4 '13 at 17:14
1  
What is the error? and what is the crontab entry? –  Mark Jan 4 '13 at 17:17
    
Whose crontab is this? Which user? –  glenn jackman Jan 4 '13 at 19:02
    
I get the error already when running the two osascript commands from Terminal, hmm. Can you replace the "Screen Recording" part in the stop script with '1' (so it says 'document 1 stop') and try again? –  patrix Jan 6 '13 at 11:04
    
Same problem running via crontab - "QuickTime Player got an error: Can’t get document 1. Invalid index. (-1719)" –  ndinev Jan 7 '13 at 9:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.