Skip to content

Instantly share code, notes, and snippets.

@sdsykes
Created August 31, 2011 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdsykes/1184640 to your computer and use it in GitHub Desktop.
Save sdsykes/1184640 to your computer and use it in GitHub Desktop.
scriptingbridge sending keystroke with control key
def four_char_code(s)
(s[0].ord << 24) + (s[1].ord << 16) + (s[2].ord << 8) + s[3].ord
end
system = SBApplication.applicationWithBundleIdentifier("com.apple.SystemEvents")
system.send(:"keystroke:using:", space_number.to_s, four_char_code('Kctl'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment