Applescript running at the Login Window?

Is it possible to script actions to occur when noone is logged into an OS X box? For example, I would like to make a script that launches the screensaver engine over the login window, then returns focus to the login window when the screensaver exits.

I have found unix shell scripts that do all of this except returning focus to the login window. I know AppleScript is more closely tailored to the GUI, and know it can set focus, so it may be a better candidate for the job.

Does this sound possible? It would prevent the screens from burning in on many Macs in my lab.

Heath Tucker

Do a man osascript in terminal. It lets you execute AS commands from the Unix shell.