Finder context menu item with Automator
I want to create a context menu item in Finder.app to open selected items with Emacs. So why not document it for others to see. Might be instructive for some as well.
- Open the
Automator.app. - Create a new document of the type Quick Action.
- On the right side of the window select
files or foldersandFinder.app. - On the left side select
Run Shell Scriptaction and drag it onto the canvas to build the workflow.
- In the
Run Shell Scriptstep change thePass inputtoas arguments. - With the following script one can select either one or more files/directories.
for f in "$@"
do
open -a Emacs "$f"
done
exit 0
- Go to File -> Save in the menu to save the workflow. Choose a name which will appear in the context menu.
- That is it. You will now find your new item in the context menu.