When programming I find it convenient to use Finder to explore directories. In the past I would often find myself wanting an easy way to copy the complete path of the selected file or files to the pasteboard (clipboard) which is (as of OSX v10.8.2) a facility that Finder lacks. So being a programmer, I added the desired functionality by adding an Automator Workflow that launches a simple Applescript to the file context menu that appears when a selected file is right-clicked in Finder.
The script works great! It adds the desired functionality and is convenient to use. However, there is a piece of behavior that I'd like to add to the script that I haven't yet been able to figure out how to do. The name of the Finder context menu item that launches the Workflow is "Copy Filename" which is fine when there is only one file selected but when multiple files are selected I'd like the name menu item to change to "Copy Filenames" or perhaps "Copy "+(The # of selected files)+" Filenames".
So my question is this: How do I, using Applescript, dynamically set the name of an item in the file context menu that appears when a selected file is right-clicked in Finder based on the number of selected files?
There is some precedent for this type of behavior. It can be seen when copying selected files in Finder. If only one file is selected the copy menu item in the context menu will read, Copy "somefile.txt" but if five files are selected the copy menu item will read, Copy 5 Items.