AppleScript Query

Discussion in 'Mac Apps and Mac App Store' started by G99, May 16, 2006.

  1. G99 macrumors 6502

    G99

    Joined:
    Mar 8, 2006
    #1
    Anyone know how to do this? I have forgotten. I used to be able to map commands such as ?+H on applescript. I'm writing a script needing this, so does anyone know how to do it? (I remember something like "keycode {? with H}) Thank you guys, in advance.
     
  2. mduser63 macrumors 68040

    mduser63

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #2
    I believe what you're looking for is the following:

    tell application "System Events"
    keystroke "?H" --(this will type '?' then 'H')
    end tell

    or for something like command-H:

    tell application "System Events"
    keystroke "H" using {command down} --(this will type command and 'H' at the same time)
    end tell

    finally, you can do something like the following:

    tell application "System Events"
    key down "?" -- press (and hold) '?' key down
    key down "H" -- press (and hold) 'H' key down
    delay 2
    key up "?" --release '?' key
    key up "H" -- release 'H' key
    end tell
     
  3. G99 thread starter macrumors 6502

    G99

    Joined:
    Mar 8, 2006
    #3
    Thanks for your help!
     

Share This Page