Skip to content

Instantly share code, notes, and snippets.

@cbess
Created February 14, 2014 06:04
Show Gist options
  • Select an option

  • Save cbess/8996488 to your computer and use it in GitHub Desktop.

Select an option

Save cbess/8996488 to your computer and use it in GitHub Desktop.
Command line access with AppleScript
-- open Terminal and do stuff
tell application "Terminal"
set currentTab to do script ("python")
delay 1
do script ("import sys") in currentTab
do script ("sys.path") in currentTab
delay 1
--close front window
end tell
-- send a keyboard shortcut/cmd to Terminal
activate application "Terminal"
tell application "System Events"
keystroke "d" using control down
end tell