A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Does anyone know applescript?

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    269

    Does anyone know applescript?

    I'm trying to write a script that wakes up my display (the computer itself is not asleep, just the display). Googling around I found this one:

    Code:
    tell application "System Events"
    	tell process "Finder"
    		keystroke space
    	end tell
    end tell
    Which does the job pretty well, except when I'm actually using the computer. In that case, that spacebar keystroke can be very annoying, i.e., if the script activates while I'm reading something in safari, the keypress makes safari scroll a full page. If I'm writing something and I have a lot of text selected and the script activates... then whatever I had selected is replaced by a space.

    So what I'm asking is: is there a better way to do this?

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488

  3. #3
    Now listen heah! Mac8myPC's Avatar
    Join Date
    Aug 2000
    Location
    Steve Job's Doorstep
    Posts
    695
    i'm not quite following... you want a keystroke that makes the display not go to sleep?

    why not just set it up that way in your energy saver prefs?

  4. #4
    Senior Member
    Join Date
    Apr 2001
    Posts
    269
    Aw, crap. I forgot we had a mac forum... I guess I'll just wait until a mod moves this thread for me, I don't want to start a duplicate.

  5. #5
    Senior Member
    Join Date
    Apr 2001
    Posts
    269
    Quote Originally Posted by Mac8myPC
    i'm not quite following... you want a keystroke that makes the display not go to sleep?

    why not just set it up that way in your energy saver prefs?
    No no, I want it to go to sleep. I just want it to wake up on an Adium event. I have an Adium event that runs the applescript when someone starts an IM conversation with me. That way, instead of having Adium making noises at 2 am, it'll just light up the display.

    That applescript just simulates pressing the spacebar, which is enough to wake the display up, but it's pretty annoying if it happens while I'm using the computer.
    Last edited by gesteves; 11-10-2005 at 11:32 PM.

  6. #6
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Gerbs probably knows.

  7. #7
    Senior Member
    Join Date
    Apr 2001
    Posts
    269
    Obviously. He is the law, after all.

  8. #8
    Now listen heah! Mac8myPC's Avatar
    Join Date
    Aug 2000
    Location
    Steve Job's Doorstep
    Posts
    695
    this might help

    http://forums.macosxhints.com/archiv...p/t-12048.html

    i found this command on the page

    tell application "Finder" to activate

    give that a shot.

  9. #9
    Senior Member
    Join Date
    Apr 2001
    Posts
    269
    It worked! Thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center