AppleScript: trying to press "w" but getting "wa"

I'm trying to press just 'w' but 'a' is pressed along with it.

osascript -e 'tell application "System Events" to key down (key code 13)'

How can I get AppleScript to just send the 'w'?


Solution 1:

You're telling Applescript to send key down and key code 13.

Just use the following:

osascript -e 'tell application "System Events" to key code 13'