Sunday, December 4, 2022

#1 2022-11-11 03:56:45 am

Registered: 2012-01-23
Posts: 113

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!

Filed under: Zoomvideo



#2 2022-11-11 04:30:04 am

From:: Greece
Registered: 2019-03-03
Posts: 2589

Re: Executing with right click

It's not about whether AppleScript can simulate mouse clicks or not. It can do a lot, including this, with System 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.

Last edited by KniazidisR (2022-11-11 04:31:48 am)

Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 15.6.1
Ram: 4 GB



#3 2022-11-11 04:38:21 am

Registered: 2019-10-23
Posts: 1091

Re: Executing with right click

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.

Node-RED makes it easy to automate IoT



#4 2022-11-11 07:12:09 am

From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 1518

Re: Executing with right click

DPaquin wrote:

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

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. … ff9142/mac

Last edited by peavine (2022-11-11 08:41:34 am)

2018 Mac mini - macOS Monterey - Script Debugger 8



#5 2022-11-13 08:37:15 pm

Registered: 2017-12-14
Posts: 304

Re: Executing with right click

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 )



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)