Skip to content


Subversion checkout URL

You can clone with
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 78 lines (60 sloc) 1.796 kB
* AppleScript which handles input and opens Terminal
* Based on modified version by JiHO:
* Modified from Marc Liyanage
* and Jonathan Austin
-- =================
-- = Event Handlers =
-- =================
on open untitled theObject
-- This is triggered when the application icon is clicked
-- Get the path of the frontmost Finder window
tell application "Finder"
set thisFolder to (the target of the front window) as alias
on error
set thisFolder to startup disk
end try
end tell
my openTerm(thisFolder)
end open untitled
on open theObject
-- This is triggered when some documents/folders are dropped on the icon
repeat with thisItem in theObject
my openTerm(thisItem)
end repeat
end open
-- =================
-- = Open Terminal =
-- =================
on openTerm(theItem)
-- Get the POSIX path of the item (dropped or Finder selection)
set thePath to POSIX path of theItem
-- display dialog thePath
-- Strip out file name to keep just directory (`dirname` like in Applescript)
repeat until thePath ends with "/"
set thePath to text 1 thru -2 of thePath
end repeat
-- display dialog thePath
-- Set the command line to run
set cdCommand to "cd " & quoted form of thePath & "; clear"
-- `cd` to there in Terminal
tell application "Terminal"
-- Make a new tab
tell application "System Events" to tell process "Terminal" to ¬
keystroke "t" using command down
-- NB: There _must_ be a better way to open a new tab
do script cdCommand in window 1
end tell
end openTerm
Jump to Line
Something went wrong with that request. Please try again.