What is the keystroke code for space bar in applescript?
Solution 1:
Your sample code works properly on my machine (running OS X 10.11.6).
If keystroke space
does not work on your machine, try the following:
tell application "System Events"
key code 49 -- space bar
end tell
Here is a list of key codes for your reference:
Source:
- Complete list of AppleScript key codes
Solution 2:
tell application "System Events"
key code 49
end tell