Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nicolaselhani

macrumors member
Original poster
Oct 1, 2015
91
49
Hello,

I created a Keyboard Shortcut using Automator to go to a specific Folder in the Finder using the steps below

1. Automator - New Quick Action - Workflow receives no input in any application
2. Run Shell Script - /bin/zsh/ - open /Users/Specific Folder
3. System Preferences - Keyboard - Shortcuts - Services - Quick Action - Set Shortcut

The shortcut works, the only thing is everytime I activate the shortcut in Finder it actually opens up a brand new Finder window with the specific folder, instead of just 'taking' me there within the current window. Is there a way to adjust the zsh script and to replace the open command with another one? I tried cd but it doesn't work.

Any help would be appreciated,

Thanks,

Nick
 
Replace the Run Shell Script action with Run AppleScript action :

AppleScript:
tell application "Finder"
set target of Finder window 1 to ("/Users/Specific folder/" as POSIX file)
end tell
 
  • Like
Reactions: nicolaselhani
Replace the Run Shell Script action with Run AppleScript action :

AppleScript:
tell application "Finder"
set target of Finder window 1 to ("/Users/Specific folder/" as POSIX file)
end tell
Thank you so much this worked perfectly.

I also tried the code @bogdanw posted but I keep getting a AppleScript error "AppleEvent Handler Failed"

Just out of curiosity what is POSIX file command mean? and is there a difference in efficiency between your method and bogdanw's code?

Thanks for all your help, really appreciate
 
Thank you so much this worked perfectly.
Glad it worked.
I also tried the code @bogdanw posted but I keep getting a AppleScript error "AppleEvent Handler Failed"
Runs fine for me.
Just out of curiosity what is POSIX file command mean? and is there a difference in efficiency between your method and bogdanw's code?
Turn this into something the Finder can deal with. Added check to see if there's a Finder window is more efficient. I assumed you had one to begin with, I'm lazy.
 
Last edited:
  • Like
Reactions: nicolaselhani
I keep getting a AppleScript error "AppleEvent Handler Failed"
If you renamed Macintosh HD to something else, use that name.
I renamed mine 11BS :)
Another way, that survives Macintosh HD renaming, is
Code:
tell application "Finder"
    activate
    if front Finder window exists then
        set target of front Finder window to folder "Specific folder" of folder "Users" of startup disk of application "Finder"
    else
        open folder "Specific folder" of folder "Users" of startup disk of application "Finder"
    end if
end tell

The difference between alias and POSIX is explained in the link above. In short:
alias "VolumeName:FolderName:SubfolderName:FileName"
POSIX "/VolumeName/FolderName/SubfolderName/FileName"
 
  • Like
Reactions: nicolaselhani
Turn this into something the Finder can deal with. Added check to see if there's a Finder window is more efficient. I assumed you had one to begin with, I'm lazy.
No worries at all, I am using the shortcut similarly to the native macOS shortcuts "Command + Shift + H" to go to User Home folder etc... so Finder would need to be open anyways. Thanks again!
 
If you renamed Macintosh HD to something else, use that name.
I renamed mine 11BS :)
Another way, that survives Macintosh HD renaming, is
Fantastic that worked thanks a lot!

The difference between alias and POSIX is explained in the link above. In short:
alias "VolumeName:FolderName:SubfolderName:FileName"
POSIX "/VolumeName/FolderName/SubfolderName/FileName"
Ok great that makes sense. I ended up running both shortcuts to see if there was a delay difference, and it's unnoticeable. Thanks for taking the time and explaining things really appreciate it!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.