Quickly navigate open/save dialog to path of Finder window

(Simon) #1

I often find myself having to save or open a file in an app with the save/open dialog pointing to some path unrelated to what I’m currently doing. In these situations it’s also often the case that in the Finder I already have a window open to the location where I actually want to save the file. Now I realize I can just drag the parent folder from the Finder onto the save/open dialog and it will ten jump to that path, but if this Finder window is buried somewhere deep in my mess of windows, that’s a bit cumbersome because it will involve Exposé and hunting down that window.

So is anybody aware of some kind of Automator script or Finder extension that would allow me to hit a key combo or a button in the open/save dialog so that the current focus open/save focus is redirected to the path of the top most Finder window?

(Robert Brenstein) #2

Simple answer: DefaultFolder

fantastic extension


(Curtis Wilcox) #3

Do you not find the folder you’re looking at in the Recent Places section of the dropdown menu at the top of the Open/Save dialog? I don’t find it there 100% of the time but often enough for it to be useful.

(Jeremy Roussak) #4

Agreed. I find myself lost when I have to use a Mac which doesn’t have it. It’s worth every penny; and Jon Gotow, its author, is a good chap.


(Simon) #5

That’s definitely a good idea. I have to admit I haven’t routinely checked there mainly because I’m trying to keep my hands on the KB rather than lose time mousing around. But it’s definitely something I’ll check out.

(frederico) #6

When I’m stuck on a Mac sans Default Folder, faced with the situation you describe, I am most likely to Command-Tab to Finder (assuming I also cannot hotkey to Finder); then I can typically quickly drag the parent folder to the target dialog, without rearranging a bunch of windows.

The Recent Places option disappoints me more often than not, and I feel like I’ve wasted my time, so I’m more likely to first go to the option as described above.

(seriously, Simon, DF is way more powerful than it appears on the surface; I’ve been using it since it was originally written; I know you generally seem averse to spending money, but this is a keyboard junkie’s best friend for file management)

All that said, it is entirely possible to write this in AppleScript; you could write one option that simply targets the frontmost Finder folder, or optionally present a list of open Finder folders, which you could then select by hotkey in the list. It would return the Posix path, and use the Go To Folder option in a Save/Open dialog.

Edit: I guess I should add that I don’t know of a readymade script, but the core is easily written; let me know if you want some help. The tricky bit is, unless you also have Keyboard Maestro ( another must have utility) the GUI scripting to insert the found file path will be slightly unsightly.

(GraphicMac) #7

I can’t say enough about DefaultFolder. There simply is no better utility for macOS.

(Matt Perl) #8

Anybody know a way to expand the “Recent Places” list to include more items? I realize it updates based on recent activity, but I’d love to have 10 or more items in that list to pick from.

(Curtis Wilcox) #9

This blog post, Manage Recent Places In OS X, describes a defaults write command to set the number of Recent Places remembered. It’s a per-user setting that I don’t think exists unless you use such a command (i.e. having five places is a built-in default).

(gastropod) #10

Curtis Wilcox wrote: "defaults write command"

Or you can try Marcel Bresink’s free TinkerTool, which gives a nice front end to many of the defaults write commands. It includes a way to increase the number of items in Recent Items menus (in the General pane).


(morwen) #11

Change the Number of Files Shown in “Open Recent ” Menu Items of…

  1. Go to the  Apple menu and open System Preferences.
  2. Choose the “General” panel.
  3. Look for the “Number of Recent Items” option near the bottom – this is often erroneously displayed in Mavericks (a bug, presumably) so just look for the number submenu next to “ Documents , Apps, and Servers”

(Christopher Stone) #12

Hey Simon,

Default Folder will let you do that with a single keystroke.

It also can present a menu of open Finder windows, so you can pick from amongst them.

On top of that it’s highly AppleScriptable.

I’ve used and evangelized Default Folder for somewhere around 25 years now and consider it one of my vital utilities.   :sunglasses:

Keyboard Maestro has also been mentioned, and it can be used to do the same thing albeit in a bit more clumsy fashion.

AppleScript can also do the job if you have something to run it via a keyboard shortcut like FastScripts or Keyboard Maestro.

It’s easy to get the paths of the Finder windows with AppleScript, but it’s slightly awkward to automate an open/save dialog – because Apple in their infinite “wisdom” has made it so.

Here’s a working example:

# Auth: Christopher Stone
# dCre: 2018/11/28 11:43
# dMod: 2018/11/28 11:54
# Appl: Finder, System Events
# Task: Help the User Navigate to a Specific Finder Window in an Open/Save Dialog.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder, @System_Events, @Navigate, @Specific, @Finder, @Window, @Open/Save, @Save, @Dialog

tell application "Finder"
   set openWindowPathList to target of windows as alias list
   set windowNameList to name of windows
end tell

repeat with i from 1 to length of windowNameList
   set item i of windowNameList to (item i of windowNameList) & tab & i
end repeat

tell application (path to frontmost application as text)
   set theWindow to choose from list windowNameList ¬
      with title "Finder Window Names" with prompt "Choose one" default items (item 1 of windowNameList) ¬
      multiple selections allowed false ¬
      without empty selection allowed
end tell

if theWindow ≠ false then
   set AppleScript's text item delimiters to tab
   set winIndex to text item 2 of item 1 of theWindow
   set windowPath to text item winIndex of openWindowPathList
   # To let the user manually enter the path in the dialog with Cmd-G.
   # set the clipboard to POSIX path of windowPath
end if

# To automatically enter the given path in the open/save dialog.
tell application "System Events"
   keystroke windowPath
   delay 0.1
   key code 36
end tell



(frederico) #13

I can’t resist pushing back a bit; for me, if you made me choose between them, I’d have to take Keyboard Maestro over Default Folder, because it does so very, very, very much more for me day to day, keystroke to keystroke. It can also be combined with scripting (as aptly demonstrated above) to force a lot of DF functions, albeit far less gracefully.

That said, when my workflow consisted of dealing with way, way, way more files and management of projects with multiple users, and multiple docs shared between project folders/servers, and renaming and moving/copying/etc was a big part of my day, DF saved my sanity. I even forced clients to purchase it I was going to be on their machines for any amount of real time, as the increased cost of my billable hours due to wasted diddling around would be far more than the cost of DF.

They are both absolutely at the top of my must-have utilities, and I’m immediately agitated when I’m stuck on a machine without either.

(Curtis Wilcox) #14

I think the System Preferences > General > Recent Items setting only controls the contents of the Recent Items submenu within the  Apple menu; the Recent Places shown within Open/Save dialogs is different and limited to five, by default.

(Alan Forkosh) #15

By the way, if you want to be able to click a list of Recent Folders, you can access it via the Go item of the Finder menu. If the folder you wish to open an item from or save to can be opened (or is open) on the desktop, you can drag it into the Open/Save dialog box to make it the active location. Often that item will be listed in the Finder->Go->Recent Folders list. Unfortunately, I do not know how to control how many items can appear in that list.

(Simon) #16

Thanks for that script, Chris. :slight_smile:

(B. Jefferson Le Blanc) #17

When you save a new document, it’s not the Finder that controls the destination folder, it’s the app your using that does so. Usually it will point to the last location you saved to. So, I also recommend Default Folder, which will give you more control over the process. Most remarkable these days you won’t have to pay an upgrade fee every year for the privilege of using software you’ve already paid for.