homeresourcesGuidesAppleScriptGuidesFinder menu

italian

Put a script in Finder contextual menu (Mac OS X 10.4 or earlier)
It is easy to keep an AppleScript ready in Finder contextual menu, by using plugins created by Automator.
In our example we will use a script that toggles the "locked" status of selected items.

Open Automator

"Automator" was introduced with Mac OS X 10.4, and is located in the "Applications" folder.
Automator is designed to create "flows" of actions, we will use it not to design a flow but simply to deploy the AppleScript Plug-in. Launch Automator.

Open Automator

"Run AppleScript"

Once Automator runs, it creates a new flow. Drag the "Run AppleScript" action in the right panel.
In order to find this action we can both use the search facility, or select the "Automator" Library.

"Run AppleScript"

Put the text of the Script

We should now to replace (* Your script goes here *) with the actual AppleSctipt code.
Please note that at run-time a reference of Finder selected items will be passed to the script, as a list, through the "input" parameter.

Put the text of the Script

i.e. we could use this script: it toggles protection status on Finder items.

on run {input, arguments}
tell application "Finder"
repeat with theItem in input
set (locked of theItem) to not (locked of theItem)
end repeat
end tell
return input
end run

Save as Plug-In

Choose now "Save as Plug-In" from "File" menu

Save as Plug-In

Name and format

Name the workflow, and choose the "Finder" option from the "Plug-in" popup menu.

Name and format

It's ready

The Finder plug-in is now available in Finder's contextual menu, in the "Automator" menu item.

It's ready

© and credits

Original article and materials realized for faqintosh.com by MadProf.

© and credits