Timed execution of scripts?

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.

Thanks

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:

global startIf
on run
	set startIf to date "01/01/2003 01:03:00"
end run

on idle
	if (current date) > startIf then
		beep
	end if
	return 30 -- run this code every 30 seconds
end idle

*Save this script as “stay open”

Hi

how to save the script as “Stay-open” and what effect does it have??

thanx

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.

http://files.macscripter.net/Prog_Utilities/iDo_Script_Scheduler_1.1.1.hqx

I have good luck with it.

Best,

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.


global mytime
set mytime to 872800
try
	with timeout of 7200 seconds - - this is to avoid a timeout error for long file transfers
	end timeout
end try
on idle
	copy (the time of (current date)) as string to currenttime
	if currenttime > mytime then
		run application "Move Archive to server2"
	end if
	return 10
end idle