MacOS – Shortcut for “Action” button on Finder toolbar

finderkeyboardmacosshortcutshortcut-menu

I am looking for a way to show a contextual menu for a Finder selected item from keyboard.

According to the answers I saw, there is no macOS full equivalent for a Windows "Context Menu" button, but maybe it is possible to have a shortcut for "Action" button on a Finder toolbar?

This is how it looks: Finder Toolbar

Best Answer

This works for me running OS Sierra.. This AppleScript code will open your active Finder window or open a new Finder window if none are open, then it will automatically click the "Action" button in your toolbar.

Notice where it says "group 2" in both lines of code. This is the location of the "Action" button in my "Finder" window. If you do not have your "Action" button located in the exact same location in your finder window, this script will produce an error and won't work.

activate application "Finder"
tell application "System Events"
    tell process "Finder"
        delay 0.5  -- may need to adjust this number
        if window 1 of application "Finder" exists then
            click menu button 1 of group 2 of toolbar 1 of window 1
        else
            tell application "Finder"
                activate
                make new Finder window
                tell application "System Events"
                    tell process "Finder"
                        delay 1 -- may need to adjust this number
                        click menu button 1 of group 2 of toolbar 1 of window 1 (* notice where it says "group 2" in both lines of code.  This is the location of the "Action" button in my "Finder" window.  If you do not have your "Action" button located in the exact same location in your finder window, this script will produce an error and won't work. *)
                    end tell
                end tell
            end tell
        end if
    end tell
end tell

Save this script in script editor app as an application. For purposes of this post, I saved the file in script editor as Finder_Action_Button_Shortcut.app

enter image description here

Open Automator app and create a new service

enter image description here

Be sure to select the files and folders option. Add a "Launch Application" action to your workflow and select the new script editor application you just saved and named: Finder_Action_Button_Shortcut.app

enter image description here

At this point save your Automator workflow file and name it something like "Finder_Action_Button_Shortcut.workflow" to your /Users/YOUR_COMPUTER_NAME/Library/Services/ folder. (if Automator during the save process does not ask you if you want to install the new service)

![enter image description here

Now this service will be available in your "Services" in Finder for any selected file or folder

![enter image description here

Be sure to add Automator.app and Finder_Action_Button_Shortcut.app to the list of applications allowed to control your computer in the System Preferences/ Security & Privacy/ Accessability/ Privacy tab

enter image description here

Next, go to System Preferences/ Keyboard/ Shortcuts/ Services and you should see your new service listed there. Go ahead and assign your new service a keyboard shortcut and BINGO! You're done

![enter image description here