I am trying to create a applescript which utilises the keystroke spacebar I have this code
tell application "System Events"
keystroke {Space}
end tell
But When I play the script "space" just doesn't work. I don't receive an error message or anything
(the whole code opens a recording software within the script that when spacebar is pressed recording stars but the script doesn't start the recording.)
This post shows how to hold a modifier key left shift and send it to system events, but is the syntax above correct to press the space bar?
Best Answer
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:Here is a list of key codes for your reference:
Source: