Right click creates new finder window at click location

finder

I would like to create a finder window by right clicking and selecting "new finder window" similar to the right clicking to create a new folder . Is this possible through automator?

Best Answer

If you are looking to open a new Finder window with its position being the current position of your mouse location… this will accomplish that for you.

This code requires the third-party utility, Cliclick.

“Cliclick” is short for “Command-Line Interface Click”. It is a a tiny shell/Terminal application that will emulate mouse clicks or series of mouse clicks (including doubleclicks and control-clicks) at arbitrary screen coordinates. Moreover, it lets you move the mouse, get the current mouse coordinates, press modifier keys etc.

It's free to download but it's donationware, and is easy to install.

On my system I have. cliclick in the following directory: /usr/local/bin/. Because of this location, in my AppleScript code and in Terminal app, I need to use the full path to cliclick to call the command. For example: do shell script "/usr/local/bin/cliclick rc:." In AppleScript is telling cliclick to right-click.

This works for me using the latest version of macOS Mojave.

Create a new Automator Quick Action document and add a “Run AppleScript” command to your workflow. Then overwrite the pre-existing text in the AppleScript command with this following code. Then save your file. I saved mine with the name “New Finder Window At Mouse Location.workflow”

set mousePosition to do shell script "/usr/local/bin/cliclick p:."

set mouseCoordinates to makeCoordinatesRecord(mousePosition)

tell application "Finder" to set position of (make new Finder window) to mouseCoordinates

on makeCoordinatesRecord(mousePosition)
    set a to offset of "," in mousePosition
    set x1 to text 1 thru (a - 1) of mousePosition as number
    set y1 to text (a + 1) thru -1 of mousePosition as number
    set mouseLocation to {x1, y1}
end makeCoordinatesRecord

enter image description here

You won't be able to access this command through “Right Click” menu but you can create a keyboard shortcut to run your new Quick Action which will open a new Finder window at your current mouse location.

enter image description here