(* Open in TextMate Copyright 2006 Ivan Leider used code by Gregory Ramsperger To use: * Drag Open In TextMate to the toolbar of any finder window to add it to the toolbar *) on run try -- get the frontmost window of the finder tell application "Finder" set dir to the target of Finder window 1 as text end tell -- convert the path from Mac to unix my oit(dir) on error -- if there is no window open in the finder, open the desktop my oit(path to desktop) end try end run -- run a command in the terminal on oit(d) tell application "Finder" -- make sure that the item is a directory if d does not end with ":" then set d to (container of item d) as text end if end tell tell application "TextMate" activate open (d) end tell end oit