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:
- type command-S, or ask Mail to save an attachment
- swipe several times to get to the Desktop
- click and hold on the icon of the top folder
- drag that icon back several swipes till I am back at the Save As dialog
- drop the icon there
The desired routine would look like:
- type command-S, or ask Mail to save an attachment
- 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:
Am I doing something wrong?