Sunday, May 31, 2020

#1 2016-10-28 08:35:19 am

From:: London
Registered: 2005-08-15
Posts: 243

Right Click Contextual Menu

Hi. Not sure whether this can be done..

What I want to do is get the values of a right click menu from a given folder then action that task.  i.e.

set x to contextMenu from folder foo

-- {menu item 1, menu item 2,....}

action menu item 1

any ideas?



#2 2019-08-04 04:34:16 pm

Registered: 2019-03-03
Posts: 1259

Re: Right Click Contextual Menu

Select the folder or the file in the Finder and run this:


tell application "Finder"
   tell window 1
       set oldView to current view
       if oldView is icon view then set current view to list view
   end tell
end tell

tell application "System Events" to tell application process "Finder"
   set theSelection to value of attribute "AXFocusedUIElement"
   tell theSelection to perform action "AXShowMenu"
end tell

tell application "Finder"
   tell window 1
       if oldView is icon view then set current view to icon view
   end tell
end tell

NOTE: The contextual menu in icon view was shown incomplete so I added if blocks to get all correct.

Last edited by KniazidisR (2019-08-06 05:28:54 am)

Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 13.1
Ram: 4 GB



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)