Wake Dim Screen? A Sort of an Adium Alert

I’m having a bit of an issue getting Applescript to wake a dimmed (not sleeping) screen. Here is my situation:
I use a Linux (gasp!) box all day, execept for graphics and instant messaging with Adium. Since I’m not using my iBook constantly I’ve set the screen to dim after so many minutes. However when I recieve an IM I want the screen to light up, that way I’ll know I’ve got a message. What I’m doing now is using an applescript trigger from Adium to play the following script:

tell application "System Events"
	tell process "Finder"
		keystroke space
	end tell
end tell

As long as I’m not using the computer, it works great. The screen undims but the problem is a space is added to whatever text field I have selected. This really becomes an issue if I’m using vi or dreamweaver and I replace whatever text I had selected with a space (because someone sent me an IM).

Does anyone know how a have-my-cake-and-it-too solution to this problem? I want to be notified when I get new IMs (by the screen undimming) when I’m not using it, but I don’t want to have to unload the Applescript every time I actually use the machine.

I could just set the script to run if the machine has been idle for so long, right? Anyone know how to do this?

-Nate Murray http://www.natemurray.com

Model: iBook
Browser: Firefox 1.5
Operating System: Mac OS X (10.4)

I use this line to turn on the Screen Saver immediately: tell application “ScreenSaverEngine” to activate" so when the screen is running the screensaver, you can trigger it to wake with this script:

tell application "System Events"
	if exists process "ScreenSaverEngine" then keystroke (ASCII character 32)
end tell

This works even if the screen has dimmed (at least in Tiger), provided that the processor is left running (the CPU doesn’t sleep) or at least is wakened by some preceding event.

That’s true, I could just have a screen saver come on at the same time as the screen dimming. That is a solution, but I’m still looking for something more satisfying, something more direct and unobtrustive. I am on a little g3 ibook after all, it takes a lot of work for it to even start and stop a screensaver! Thanks for your reply.

To start the screensaver and power down the screen and HD, I use these commands:

tell application "ScreenSaverEngine" to activate
delay 3 -- for the screensaver to get going
do shell script "sudo pmset dim 1 spindown 1" user name "YourUName" password "YourAdminPW" with administrator privileges

As an addendum, I also run a little application called jiggler that prevents the screen from ever sleeping by faking a mouse wiggle (1 pixel).

When I wake the machine, I do a bunch of stuff, but at the heart of it all I reset the screen dim and spindown times to never as follows:

do shell script "sudo pmset dim 0 spindown 0" user name "YourUName" password "YourAdminPW" with administrator privileges
-- setting dim and spindown to 0 is equivalent to "never" (1 minute is the minimum to dim or spindown)
do shell script "diskutil info \"POSIX path to disk\" > /dev/null"

The second of these commands happens while sudo is still active, and all it does is write some stuff on the disk (but probably not in memory) to a temp file so the HD will have to spin up to get it.

Again as an addendum: I use FastScripts to get key combos for my scripts (but there are other ways) so I sleep and wake the machine with simple key combinations.