Skip to content

Instantly share code, notes, and snippets.

@leighmcculloch
Created June 17, 2012 11:21
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 leighmcculloch/2944239 to your computer and use it in GitHub Desktop.
Save leighmcculloch/2944239 to your computer and use it in GitHub Desktop.
Auto-Type
# Author: Leigh McCulloch
# License: BSL-1.0 (http://www.opensource.org/licenses/BSL-1.0)
#
# This script takes arguments from the command line and autotypes
# them with tab separators into the last selected application.
# This can be used from one application to auto-type into another
# application.
#
# Command line usage:
# osascript autotype.spct [username] [password]
#
# Usage in Cocoa application:
# See http://stackoverflow.com/questions/4909702/run-applescript-from-cocoa-application
on run argv
tell application "System Events"
keystroke tab using (command down)
delay 0.5
repeat with arg in argv
keystroke arg
keystroke tab
end repeat
key code return
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment