Delay Timer - Show Time Left

Hi,

I’ve written a script that I’d like to run every 6 hours.
sub-question: just checking - does the delay integer represent seconds??

I’d like to show a timer or at least what time the script will next be run, even if it just opens a text file and prints that information in there. Is this possible?

on idle
	set filename to "helloworld.scpt" as text
	set myScript to alias ((path to desktop as text) & filename)
	run script myScript
	delay 21600
end idle

The script that is being run (for test purposes) is this simple one:

say "hello world"

changing the delay on the previous script doesnt seem to have any bearing on how often the script is executed though. It seems to be once every 30 seconds or so.

If my memory is right the correct syntax would be :

on idle
	set filename to "helloworld.scpt" as text
	set myScript to alias ((path to desktop as text) & filename)
	run script myScript
	return 21600 # it's this value which defines the time to wait before next pass.
end idle

Always if I remember well, the late instruction may be reduced as :

21600 # it's this value which defines the time to wait before next pass.

It would be useful to search for “idle handlers” in AppleScript Language Guide:
https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_about_handlers.html#//apple_ref/doc/uid/TP40000983-CH206-SW1

Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) vendredi 28 juillet 2017 13:34:55