AppleScript Query

G99

macrumors 6502
Original poster
Mar 8, 2006
366
0
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.
 

mduser63

macrumors 68040
Nov 9, 2004
3,038
30
Salt Lake City, UT
G99 said:
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.
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
 

G99

macrumors 6502
Original poster
Mar 8, 2006
366
0
mduser63 said:
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
Thanks for your help!