Open Files/Folders Selected in Finder with Sublime Text 3 in Mac OS X

by 7/04/2013 04:17:00 PM 0 comments
Sublime Text is a great text editor. Here's a little AppleScript that can help open folders or files selected in the finder directly with Sublime Text 3. To use the script:

  1.  Open AppleScriptEditor 
  2.  Open a new editor (File -> New) 
  3. Paste the code below into the editor 
  4. Press the compile button to make sure it was copied correctly 
  5. Export as an Application (File -> Export, Make sure you select 'Application' as the File Format. I usually save my scripts to '~/Library/Scripts' but the location isn't so important. 
  6. Drag your newly saved application onto the Finder's toolbar 
  7. That's it. Just press it whenever you want to open selected Files/Folders in Sublime Text 3 
  8. You can change the icon on your new Application by following these instructions.

 Open in Sublime Text
 To use:
  * Drag Open In TextMate to the toolbar of any finder
  window to add it to the toolbar

on run
 tell application "Finder"
  if selection is {} then
   set finderSelection to folder of the front window as string
   set finderSelection to selection as alias list
  end if
 end tell
end run

-- script was drag-and-dropped onto
on open (theList)
end open

-- open in Sublime Text
on subl(listOfAliases)
 tell application "Sublime Text"
  open listOfAliases
 end tell
end subl

Brian Schlining


Cras justo odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.