Reputation: 41
im using apple script in automator for the first time. i want the script to execute a keyboard shortcut within a previously launched application.
on run
activate application "MacCaption"
tell application "MacCaption"
keystroke "x" using command down
end tell
Im getting Syntax Error expected end of line but found identifier on the word using.
Upvotes: 4
Views: 5856
Reputation: 16275
Your problem is that keystroke
has to go through System Events. Either:
tell app "System Events"
keystroke "x" using command down
end tell
or
tell app "System Events"
tell process "MacCaption"
keystroke "x" using command down
end tell
end tell
There's no real difference, but you need the System Events.
Upvotes: 3
Reputation: 11238
Try:
tell application "System Events" to keystroke "x" using command down
Upvotes: 1