In case anyone is interested, I came up with a way to selectively disable the screensaver when certain applications are running. This works under Snow Leopard and probably under Leopard. Although this is principally done with an AppleScript, you’ll also need Xcode to create a small auxiliary executable. All this executable does is invoke the UpdateSystemActivity() routine to reset the system’s idle time counter. The AppleScript invokes this periodically (at an interval less than the screensaver’s idle time) whenever the programs of interest are running.
First of all open up a file called update_activity.m and put the following code into it:
Then, compile it as follows:
Install the resulting update_activity executable in some place like /usr/local/bin.
Then, create the following AppleScript:
property idlePause : 60 -- how long to wait between checks for programs' status (in seconds)
property resetSystemIdleTimeProgram : "/usr/local/bin/update_activity"
property programList : {"QuickTime Player", "QuickTime Player 7"}
on idle
tell application "System Events"
repeat with theProgram in programList
try
if (exists process theProgram) then
do shell script resetSystemIdleTimeProgram
exit repeat
end if
end try
end repeat
end tell
return idlePause
end idle
Put the full pathname of the executable created above into the resetSystemIdleTimeProgram property, and put the list of the applications that you want to monitor into the programList property.
Save this as an Application, and be sure to select Stay Open.
Then, set this app to run as one of your Login Items, and you’re all set.
Some day when I have more spare time, I’ll figure out how to store the list of programs externally, so that the AppleScript can read it at run time and it doesn’t have to be changed every time this list is altered.
I have been using this for a while, and it works fine for me.