What I do is just insert a program (script application). The command looks like this with my AppleScript script application located on my desktop:
/usr/bin/open /Users/kel/Desktop/SayTime
Or I think you can just drag your script application into the CronniX window. I think of the asterisk as “every”. So if I wanted every 10 minutes, then in the minutes column I would enter:
*/10
which tells it to set up a crontab to run my script app “SayTime” every 10 minutes and all the other fields are asterisks (for every hour, every day, etc.).
As soon as you save your crontab settings it should begin waiting for the time to run your script.
Kel’s instructions will get you running every 10 minutes. Just so you know the difference, the notation you used would be appropriate if you wanted to run 10 minutes after the hour. Get it?
Ok, this is aggrevating because it should be so bleeping simple.
Here is the screen shot of my tab…
And yes, I am aware that earlier I stated I wanted it to to run every 10 min but for testing purposes - I have tossed in a 2.
Thanks, by the way, for the tip on the “*/”!
Again, if I utilze the run now feature, the script runs perfectly. The Cronnix tab, once saved, does nothing.
If I use the /usr/bin/open option rather than osascript - the script appears to be called, because ScriptEditor launches (although it is not told to in the script) and the sequence stops. The script does not appear to process.
I just tried the /usr/bin/osascript option rather than the /usr/bin/open or simply osascript & that doesn’t appear to do anything.
Just for info purposes - here is the script that I am calling.
tell application "System Events" to set isRunning to exists process "Camino"
if isRunning is true then
--Get Date in form MMDDHHMM - hours & minutes in Military Time
set theDate to (do shell script "date "+%m%d%H%M"")
--define folder to save files in
set save_location to "Macintosh HD:Users:scottc:Documents:eBooks:"
--capture the baby
do shell script "screencapture -x " & quoted form of POSIX path of save_location �
& "sc" & theDate & ".pdf"
end if
I’m not sure why OSAScript isn’t working. Do you know how to use mail in terminal to view the STDERR output of your chron job? Kel suggested using OPEN, and that’s how I do it too. To make this work, open your script and save it as an Application (File/Save As - select the application format). The resulting file will have a .app extension . Use “/usr/bin/open /Users/kel/Desktop/SayTime.app” as your cron call, and you should be good to go.
You’ll know you’ve got the thing saved correctly if you can double-click on your application and it just runs. Script editor will not open. To edit the script once it’s saved as an application, drag it on to script editor. When you save as an application, don’t check the “run only” check box. That will prevent your code from being saved in the application file.
Secondly… that works fine… but my question is why? Why does the script work fine when called from Cronnix with the Run Now command:
do shell script "screencapture -x "...
but when actually saved to the cron tab, it needs:
do shell script "/usr/sbin/screencapture -x"...
Is it because Cronnix is being called from the OSX shell and the cron tab is being called from some remote part of the unix environment? (I think the answer to this will be helpful to other users down the road, as well.)
I’ll bet you’re explanation is exactly right. Type “env” in your bash shell in terminal and you’ll probably see that /usr/sbin/ is in your search path.