tell application appname
activate
tell application “System Events”
tell process appname
tell window “Find”
keystroke “f” with command down keystroke tab group
end tell
end tell
end tell
end tell
–Compiles into
tell application appname
activate
tell application “System Events”
tell process appname
tell window “Find”
keystroke “f” with command down keystroke tab group
end tell
end tell
end tell
end tell
– It does not press the tab button
– How do i do it???
Assuming that you are the one who asked this question on the Apple forum, here’s the reply that I just attempted to post. Unfortunately, Apple shut down the forums as I was composing the reply. :?
Which application are you working with? It’s sometimes possible to simply activate the target application and then perform the keystrokes outside of the 'tell process appname" block. For instance:
tell application "Finder" to activate
tell application "System Events"
keystroke "f" with command down
delay 2
keystroke "1"
keystroke return
end tell
On my machine, this opens the Finder’s search dialog, enters 1 and then proceeds with the search (be ready to cancel the search if you run the code!)