TextMate in Path Finder

Note: This post is over a year and a half old. You may want to check later in this blog to see if there is new information.

Edit in TextmateI claimed in my last post that Path Finder had great integration with TextMate, and it does to an extent. However, I had forgotten that it takes quite a bit of fiddling to get any kind of decent project management out of the context menus (and some more third party applications). So to try to avoid that I put together this applescript (see below). Paste it into Script Editor and save it as an application in ~/Library/Scripts/Applications/Path Finder. If you want a pretty icon for it, find the TextMate application in your Applications folder and open an info window and highlight the small icon at the top left and hit ⌘-C. Then open the info window for your new script application and highlight the script icon and press ⌘-V. Now just drag it into the menu bar at the top of a Path Finder window.

The script allows you to select a single directory and open it as a project, or open a single file. If you select multiple files or folders it will create a project from those files. Just highlight your selection and click the icon.

CODE:
  1. tell application “Path Finder”
  2.     set selection_list to selection
  3.     set ThePath to ””
  4.     if the (count of selection_list) = 1 then
  5.         set theItem to the first item of selection_list
  6.         set ThePath to quoted form of (POSIX path of the theItem as string)
  7.     else
  8.         set file_list to ””
  9.         repeat with one_item in selection_list
  10.             set file_list to file_list & (POSIX path of one_item as string) & ” “
  11.         end repeat
  12.         set ThePath to file_list
  13.     end if
  14.     set TheCommand to “open -a TextMate  “ & ThePath
  15.     do shell script TheCommand
  16. end tell

If you just want to download the file and not deal with all of the above… go ahead: Open_in_TM.app.zip

» » » » » »
  1. Reinier Meenhorst 01.19.07 / 3am

    Works fo me, thanks Brett!

  2. Dan Feder 01.28.08 / 12pm

    Any way to modify this to just open the current folder if nothing is selected? I have been trying with out luck to code this.

  3. brett 01.28.08 / 1pm

    Actually, it did that already, but AppleScript in Path Finder has been broken for some time now. I’m waiting for a fix, which will probably change the terminology in the script but should make this work again.

Have your say

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>




Safari hates me