Macro to set open/save dialog to frontmost finder window?

I would like to create a macro that would let me press a key to set the current location of an open/save dialog screen to the frontmost Finder window. Bonus points for tips on a macro that can set the location of the open/save dialog to the second frontmost Finder window, and so on.

I realize that I can just drag the little folder icon of a given finder window into an open/save dialog, but that involves a LOT of clicking and dragging as you have to be able to see both the finder window and the open/save dialog at the same time. This can be particularly hard on a 11" screen. If such a macro could be built, it would save a lot of time and mousing over the course of the day.

I also realize that somewhat similar functionality is available in DefaultFolderX. However, there's still a lot of mousing (must find the window and command-click on it).

On a related note - it it possible to create a macro group that is only active when a file open/save dialog is open?

Thanks!

John Feinberg
Montclair, NJ

Have you tried this:


Edit/PS:

Welcome to the forum! :nerd_face::yum:

(just seen now that this was your first post)

This is really great - your macro does EXACTLY what I wanted. I used the latest version, which uses paste text rather than type as text. I am also able to get away with an 0.1 second pause rather than an 0.5 second pause. Saves literally hundreds of milliseconds. :slight_smile:
In all seriousness, this shortcut is much, much snappier than command-clicking on a folder with DefaultFolder X. Opening and saving files is much, much more reponsive since I don't need to have DefaultFolderX running anymore (due to this new macro) so it doesn't have to draw all of the Default Folder X graphics, which took over a second each time such a dialog opened.

My link from above is not pointing to my macro, it was meant to point to @peternlewis’s macro, more precisely it is pointing to the topic Peter has started. (My macro is the one in the follow-up post. But I would recommend to use Peter’s original macro, unless you need the additional functionality of my macro.)

But, no matter which macro you are currently using, glad I could help.

:slightly_smiling_face:

I did find @peternlewis's topic, so I got to see a few different approaches to solving this problem. I liked the paste text approach rather than type text. Faster!

Thanks again for your response to my question. This is really a great macro for me to have working on my machine.

1 Like

Whether inserting text by typing or pasting, is not necessarily an issue. Just try to switch the corresponding action to “insert by pasting” instead of “insert by typing” and see if it still works.

The main difference between Peter’s original macro and my follow-up variant is that my variant also lets you select a previous (recent) frontmost Finder window. But you don’t have to; if you just hit Return you’ll get the currently frontmost window just as fine.

On the other hand, I’m not sure if my macro still works with the current KM8. That’s why I recommended to use Peter’s original macro, which is way more simpler and robust.

I will test it tomorrow.


PS:

Personally I don’t use any of the two macros, because I’m perfectly fine with Default Folder X’s ⌘-Click on a window :wink:


PS #2:

To answer your other question:

On a related note - it it possible to create a macro group that is only active when a file open/save dialog is open?

I don’t think so. But you could create a condition (via an action) that checks if for example an “Open” or “Save” button is present. But, depending on the trigger, this could be pretty resource-intensive (since it has to respond always), so I wouldn’t do it.

Unless somebody has a better idea on that.