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.

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.

https://support.apple.com/en-ke/guide/mac-help/mchl97ff9142/mac

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 )