Frequently what I would like to do in a Save As dialog box is to click a single button or type a single command that would select the top window in the Finder (or another active Finder window, but it is almost always the top one) as the folder/directory in which to save the file (often a Mail attachment, but also many other documents in other applications). The best I know how to do is to drag that folder's icon onto the Save As dialog, but I make abundant use of Full Screen mode, so this is quite cumbersome.

In sum, my current routine is:

  1. type command-S, or ask Mail to save an attachment
  2. swipe several times to get to the Desktop
  3. click and hold on the icon of the top folder
  4. drag that icon back several swipes till I am back at the Save As dialog
  5. drop the icon there

The desired routine would look like:

  1. type command-S, or ask Mail to save an attachment
  2. type another command to have the Save As dialog jump straight to the top Finder window.

Is there a built-in way to do that? Or a simple way to customize it using Automator or such? I am hoping for a universal solution, not one that works only on Apple Mail.

(I am using MacOS 10.15.7, but this has been a long-standing question for me, so I suspect it may still not be obvious in more recent versions.)

Update: question about Ezekiel's answer

At my request, @Ezekiel updated his answer to this question to skip the copy-paste step and simply output the filepath harvested by the Applescript into the Go To text field.

When I tried to implement that, I ran into the problem that if, in Automator (MacOS 10.15.7), I check the box "Output replaces selected text", the Service no longer appears in the Services menu when the Save As dialog is open/active. If I open TextEdit, the script works as expected, outputting the filepath of the (first tab of the) top Finder window into the program.

This is what my Automator looks like:

enter image description here

Am I doing something wrong?

  • Aren't places you recently opened with Finder showing up in drop-down menu under "Recent places"? Commented Jan 6, 2023 at 7:12
  • @AivarPaalberg: No, what shows up under "Recent places" in the Save As dialog are places I have recently saved an attachment (I checked in Mail) or from which I have recently selected an attachment using the "Attach a document to this message" button in the compose window. (This is my inference based on the following test: I opened a new folder in the Finder, swiped over to Mail, and looked at the Recent places list; that new folder that I had just opened was not there but various places I have recently saved to or attached from were.) Commented Jan 6, 2023 at 18:18

1 Answer 1


You can make a service that returns the path, or copies it to your clipboard when not run from a text field:

  1. Create a Shortcut with the following single Run AppleScript step:
tell application "Finder"
    if exists Finder window 1 then
        set theAlias to the target of Finder window 1 as alias
        set thePath to the POSIX path of theAlias
        return thePath
    end if
end tell
  1. Configure the Shortcut to appear in the Services Menu and optionally click "Add Keyboard Shortcut."

  2. Configure the Shortcut to Provide Output, and set it to Copy to Clipboard when there's nowhere to output.

  3. When saving, press ⌘ + ⇧ + G and either press the keyboard shortcut or right click and choose Services > [Service Name]. If you don't have many services, it may appear at the top-level of the context menu.

Full Shortcut

  • Thank you, this is very close. I just tested it and found that the path that it copies is the first tab from the top Finder window, but I would like it to select the active tab in the top Finder window. Is there a way to tweak the script to do so? Also, is there a way to fold the "Go To" and paste operations into the script, so that I don't have to type three separate commands (run the Services script, shift+command+G, command+V) and then press Return to perform this single operation? Commented Jan 8, 2023 at 20:30
  • As a bonus, it would be great if the solution could avoid modifying the clipboard. Commented Jan 8, 2023 at 21:12
  • 1
    @AlexRoberts I am unsure how to resolve the tab issue, I've done some googling and have not found anything. For the second question, I have amended my answer to provide it as output. You can disable "Copy to Clipboard" if you'd like to avoid editing the clipboard.
    – Ezekiel
    Commented Jan 8, 2023 at 22:44
  • Does this Stackoverflow answer help, @Ezekiel? I don't really understand what the radio button is that it refers to, but maybe that is the key to referencing tabs somehow? Commented Jan 8, 2023 at 23:30
  • 1
    you're right, it now seems to select the active tab, not the first tab. I'm not sure if I was doing something wrong or if the original script you wrote behaves differently somehow. In any case, on the larger point, I haven't managed to get this solution to work exactly as you describe, but that's no surprise since I'm on an outdated system. And your original solution was already much better than what I was doing. So I'm marking this as the answer, and maybe I'll get your more sophisticated solution to work one day if I ever update. Thank you. Commented Jan 9, 2023 at 4:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .