Is it possible to set up an Applescript for timed execution? I want to move some fairly substantial sized files to a server and I’d like to set the script to execute for some time in the middle of the night to avoid tying up my computer and the server during the day.
There are many apps which will launch a file x (eg., a script) when time is x (eg, iDo).
But you can set up a simple “on idle” handler and keep the script running:
set startIf to date "01/01/2003 01:03:00"
if (current date) > startIf then
return 30 -- run this code every 30 seconds
*Save this script as “stay open”
how to save the script as “Stay-open” and what effect does it have??
When you save your script as an applet, check the ‘stay open’ check box in the same window. Checking the ‘stay open’ check box will cause the script to call the idle handler and to execute it and to perform task at given times. in the last example, the idel handler is called every 30 seconds and check for the date.
Or, you can opt for a script scheduler. iDo Script Scheduler is free for up to 3 scheduled events and you can get it right here.
I have good luck with it.
Using your stay open script idea, I found that if I substitute actual time in seconds and use just the time from current date I can specify an exact excution time.
set mytime to 872800
with timeout of 7200 seconds - - this is to avoid a timeout error for long file transfers
copy (the time of (current date)) as string to currenttime
if currenttime > mytime then
run application "Move Archive to server2"