3

Open folder or file with Sublime Text from Finder toolbar

 3 years ago
source link: https://herrkaefer.com/open-folder-or-file-with-sublime-text-from-finder-toolbar/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Open folder or file with Sublime Text from Finder toolbar

open-with-sublime.png

Check this out for more tiny Finder toolbar applications

Solution

Make a light-weighted application with AppleScript.

Step 1

Create a new AppleScript script, input:

try
	tell application "Finder"
		set sel to selection
		set numElements to count sel
		if numElements is 1 then
			set itemPath to POSIX path of (sel as string)
		else
			set itemPath to POSIX path of ((folder of the front Finder window) as alias)
		end if
		tell application "Terminal"
			do shell script "/usr/local/bin/subl " & quoted form of itemPath
		end tell
	end tell
on error
	log "Error: No selection"
end try
  • Export it as an application.
  • Move it to “Application” folder.
  • Cmd + Drag it to Finder’s toobar.

Step 2:

Open System Preferences > Security & Privacy > Privacy > Accessibility, add your app to the list.

Read more articles

Leave a Reply Cancel reply

Comment

Save my name, email, and website in this browser for the next time I comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK