Kill screen saver for cron job

Hi all-

So I have a cron job that opens an applescript that does some stuff, including opening FileMaker and running a FileMaker script. This script is called in the middle of the night on a computer that’s always on, and because of security concerns, the screen saver has a password. When there’s no password, the job runs fine, but when there’s a password, it stalls until someone disables the screen saver and enters the correct password.

So, what I want to do is kill the screen saver first, then run the applescript, then start up the screen saver again. I’m thinking of setting up a cron job right before my applescript job that kills the process, but I don’t know if this is possible. Anyone have any suggestions?

Thanks!

To kill the screensaver all you need is (the equivalent of hitting the spacebar):

tell application "System Events" to keystroke space

and to restart the screensaver:

tell application "ScreenSaverEngine" to activate

Right, that makes sense, but will this bypass the security setting? I was thinking that actually killing the screen saver process itself would quit it without the security being activated.

Thanks!

Given that the security setting for awakening a screen saved machine is in a separate Security preference pane, I have my doubts, but haven’t tried it because I don’t use ScreenSaver security. I suspect (without knowing) that the screensaver engine simply “informs” the security engine and that that’s not easy to circumvent - if it is, it’s not very secure. I suspect you’re better off to deal with the login directly.