
Adjust the value(s) of and or add/remove the delay command(s) as appropriate. however note that the value of any delay command will need to be adjusted for your system, and or additional delay commands may or may not be needed. I also did not need to use a delay command between perform action. Noted that this was tested and works as stated on my system running macOS High Sierra 10.13.4 regardless of what app had focus when the keys were pressed. Using Script Editor, I saved the code above as Go to Folder.scpt in ~/Library/Scripts and in FastScripts assigned it the keyboard shortcut ⌃⇧⌘G until such time I find it conflicts with any other app I use. Tell UI element "Finder" of list 1 of application process "Dock"Ĭlick menu item "Go to Folder…" of menu 1 I mention this because when going the Automator Service route it can require adding two or more apps to get this same script just to run, however it will still not function as desired as an Automator Service and why FastScripts is being recommended.Įxample AppleScript code: tell application "System Events" That said, if you want to test the example AppleScript code before saving it, you do need to add Script Editor, but it's not required for the actual functioning under FastScripts. In other words, if FastScripts is the only app in Accessibility for Security & Privacy this script will function as intended. The following example AppleScript code used in conjunction with FastScripts will do as you asked under the expressed conditions in your OP and you will only need to add FastScripts to System Preferences > Security & Privacy > Privacy > Accessibility in order to have this script function.

Note that I have no affiliation with the developer of FastScripts and am just a satisfied user of the product. FastScripts.Īpple has made it increasingly more difficult to use an Automator Service in particular cases and as such, this particular use case, I personally use and recommend FastScripts. ⌃⇧⌘G so the default keyboard shortcut can be used in this case to trigger the example AppleScript code used in this answer with e.g. Personally I try to avoid doing this, however to make changes, the target menu command can be added to: System Preferences > Keyboard > Shortcuts > App ShortcutsĪs an example, Go to Folder… of the Go menu in Finder can be added and its default ⇧⌘G can be modified to e.g.

Keep in mind though that the default, developer assigned, keyboard shortcuts of most any given application can be modified in order to free up a particular combination that one may want to use. Also making the fourth key something other then the typical alpha keys may be more beneficial in avoiding something already assigned. While one would like to have to press as few keys as possible, nonetheless using a four key sequence is probably going to be the best bet to avoid stepping on a default keyboard shortcut that is already assigned to the OS and or any app that has focus when the keys are pressed. It should stand to reason that any user assigned global keyboard shortcut has to be unique to both the OS and any application that has focus when the keys are pressed, otherwise it will not function as desired. First a word about global keyboard shortcuts.
