Executing with right click

Hello long time not being on the forum.

I would like to execute an applescript application using the right clip on Finder.

For example, my files are located in folder Macintoshd/recorder/mp4files/

They are to be copied on NAS volume folder called /comp1/mp4files

The application (applescrpit) would be called “MP4toNAS”.

I would like to select the files (one or many) in selecting followed by a right click and open with “MP4toNAS”. In doing so the selected files would then start to be copied onto the NAS folder.

Can an AppleScript application be executed with a right click in Finder? Has anyone did that? Is there something special which need to be done to passed the selected files as a parameter ?

Thanks in advance for your help!

It’s not about whether AppleScript can simulate mouse clicks or not. It can do a lot, including this, with System Events.app and GUI scripting, but thinking about clicks in the first place is poor thinking, lack of imagination.

It is like a donkey obediently reaching for a bunch of thistles and not noticing the surrounding greenery. There are at least a few more efficient ways to handle Finder selections that don’t use this “bundle of thistles” which is what GUI scripting is all about.

When I read your approach I see (complicated process), my approach would be.

I asume that your destination do not change.
So I would set your destination to a variable.

Use AppleScript to choose files with multiply selection as POSIX path. (do shell script)
And use the unix command ‘cp’


I would use Finder with repeat loop

set theDestination to (path to desktop)
set theSelections to (choose file with multiple selections allowed)

tell application "Finder"
	repeat with anItem in theSelections
		copy file anItem to folder theDestination
	end repeat
end tell


I will use ASObjC to use NSFileManager class

PS. If you choose Finder you have the option to UNDO

If that is not what you are looking for, and still like to use your solution then GUI scripting
and unix command cliclick could do the way your describe your process.

I do not know of a way to execute an AppleScript with the right-click menu with macOS alone. The only exception is to place the script into a shortcut or Automator Quick Action, which will then be available by way of the Quick Actions submenu of the right-click menu. This requires a recent version of macOS, though.


You need to create a service.

Use Automator, create a service,
Set the conditions for it. (Ie works in files / finder 2 must be mp4)
Add your AppleScript.
Save it . (May have to move to services folder )