Skip to content

Instantly share code, notes, and snippets.

@vitorgalvao
Last active March 16, 2023 14:30

Revisions

  1. vitorgalvao renamed this gist Feb 11, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Right-Click.applescript → Right Click.applescript
    Original file line number Diff line number Diff line change
    @@ -24,4 +24,4 @@ tell application "System Events" to tell process "Finder"
    else
    tell value of attribute "AXFocusedUIElement" to perform action "AXShowMenu"
    end if
    end tell
    end tell
  2. vitorgalvao renamed this gist Sep 21, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. vitorgalvao revised this gist Aug 4, 2021. 1 changed file with 15 additions and 7 deletions.
    22 changes: 15 additions & 7 deletions RightClick.applescript
    Original file line number Diff line number Diff line change
    @@ -9,11 +9,19 @@ You can install it as a [Finder Service, and later asign it a keyboard shortcut]
    *)

    tell application "System Events" to set frontApp to name of first process whose frontmost is true
    tell application "Finder"
    if not frontmost then tell me to error "Finder is not the frontmost app"

    tell application "System Events"
    tell application process frontApp
    set _selection to value of attribute "AXFocusedUIElement"
    tell _selection to perform action "AXShowMenu"
    end tell
    end tell
    set selected_items to the selection
    if selected_items is {} then tell me to error "Nothing selected!"

    set on_desktop to (insertion location as alias) is (path to desktop folder)
    end tell

    tell application "System Events" to tell process "Finder"
    if on_desktop then
    tell group 1 of scroll area 1 to tell (image 1 whose value of attribute "AXFilename" is the name of (item 1 of selected_items)) to perform action "AXShowMenu"
    else
    tell value of attribute "AXFocusedUIElement" to perform action "AXShowMenu"
    end if
    end tell
  4. vitorgalvao revised this gist Nov 19, 2020. 1 changed file with 9 additions and 11 deletions.
    20 changes: 9 additions & 11 deletions RightClick.applescript
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    (*
    Even though a [native solution][1] exists, it still suffers from a big flaw: it right-clicks the place you cursor is, not what you’re selecting. This addresses that limitation.
    You can install this as a [Finder Service, and later asign it a keyboard shortcut][2].
    A [native solution][1] exists but it suffers from a major flaw: it right-clicks where the cursor is, not what on the selection.
    This code addresses that limitation, though it only works on Finder windows and not the Desktop.
    You can install it as a [Finder Service, and later asign it a keyboard shortcut][2].
    [1]: http://stackoverflow.com/questions/9171613/right-click-shortcut-for-mac-lion-os
    [2]: http://www.macosxautomation.com/services/learn/tut01/index.html
    @@ -11,11 +11,9 @@ You can install this as a [Finder Service, and later asign it a keyboard shortcu

    tell application "System Events" to set frontApp to name of first process whose frontmost is true

    if (frontApp = "Finder") then
    tell application "System Events"
    tell application process "Finder"
    set _selection to value of attribute "AXFocusedUIElement"
    tell _selection to perform action "AXShowMenu"
    end tell
    end tell
    end if
    tell application "System Events"
    tell application process frontApp
    set _selection to value of attribute "AXFocusedUIElement"
    tell _selection to perform action "AXShowMenu"
    end tell
    end tell
  5. vitorgalvao revised this gist Mar 20, 2017. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions RightClick.applescript
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,11 @@
    (*
    Even though [a native solution](http://stackoverflow.com/questions/9171613/right-click-shortcut-for-mac-lion-os) exists, it still suffers from a big flaw (it right-clicks the place you cursour is, not what you’re selecting). This addresses that limitation.
    Even though a [native solution][1] exists, it still suffers from a big flaw: it right-clicks the place you cursor is, not what you’re selecting. This addresses that limitation.
    You can install this as a [Finder Service, , and later asign it a keyboard shortcut](http://www.macosxautomation.com/services/learn/tut01/index.html).
    You can install this as a [Finder Service, and later asign it a keyboard shortcut][2].
    [1]: http://stackoverflow.com/questions/9171613/right-click-shortcut-for-mac-lion-os
    [2]: http://www.macosxautomation.com/services/learn/tut01/index.html
    *)

  6. vitorgalvao revised this gist May 14, 2014. 1 changed file with 9 additions and 5 deletions.
    14 changes: 9 additions & 5 deletions RightClick.applescript
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,13 @@ You can install this as a [Finder Service, , and later asign it a keyboard short
    *)

    tell application "System Events"
    tell application process "Finder"
    set _selection to value of attribute "AXFocusedUIElement"
    tell _selection to perform action "AXShowMenu"
    tell application "System Events" to set frontApp to name of first process whose frontmost is true

    if (frontApp = "Finder") then
    tell application "System Events"
    tell application process "Finder"
    set _selection to value of attribute "AXFocusedUIElement"
    tell _selection to perform action "AXShowMenu"
    end tell
    end tell
    end tell
    end if
  7. vitorgalvao created this gist Sep 22, 2013.
    14 changes: 14 additions & 0 deletions RightClick.applescript
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    (*
    Even though [a native solution](http://stackoverflow.com/questions/9171613/right-click-shortcut-for-mac-lion-os) exists, it still suffers from a big flaw (it right-clicks the place you cursour is, not what you’re selecting). This addresses that limitation.
    You can install this as a [Finder Service, , and later asign it a keyboard shortcut](http://www.macosxautomation.com/services/learn/tut01/index.html).
    *)

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