Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use AppleScripts to generate web pages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use AppleScripts to generate web pages
Authored by: Graff on Dec 23, '03 12:14:29AM
On idle
-- put code here
return 60 -- sets return rate to every 60 seconds
End idle

The script is compiled as an application with the "stay open" button checked in the Save dialog box. Hint: use "on run" to debug your script, then change to "on idle" at the end.

Right, and remember that you can have both "on run" and "on idle" handlers in your script, along with other handlers that do other sorts of stuff.

The "on run" handler does stuff as soon as the script application is run. If you don't save the script as a stay-open application then it will quit once the "on run" handler is done. Even if you have an idle handler in your program you probably would still have a run handler to do setup sort of stuff.

The "on idle" handler is for performing tasks occasionally in a stay-open script application. It is good for monitoring, performing stuff in the background, idling until the script is re-activated by another program, etc.

There is also an "on quit" handler which traps the normal quitting of the script application and does some cleanup before quitting. Since a quit event will interrupt any other processing going on in the script application this is important. When you are done cleaning up a "continue quit" statement in the "on quit" handler will cause the application to end.

You can also define your own handlers which are basically functions. For example, a "DrawPage" handler which draws the web page when called by your run or idle handler. These handlers can be called by other scripts and programs.



[ Reply to This | # ]