How to Select a Specific File in an Open or Save Dialog Window

Hey fellows,

I'm a newbie and definitely don't want to flood forum with duplicate topics, so here is my question.
At one point in my script I need to tell keyboard maestro to pick up specific file from the folder, neither file or folder changes, for future usages:

  1. I click upload on website.

  2. Finder file selection window pops-up
    How do I tell or modify the script so it will always select:

Thank you for any help!!!!! or hints what to modify in script :))))

Hey Costa,

In any Open or Save dialog you can hit G to bring up a sheet to type or paste a path string into.

So your sequence would be something like:

  • Type a Keystroke G
  • Pause Until a button named “Go” exists.
  • Insert Text by Pasting your complete posix path string to the file.
  • Press a Button “Go”.
  • Pause Until a button named “Choose” is active.
  • Press a Button “Choose”.



works like a charm.
Thank you Chris

...and another thank you to Chris!

Today is the day KM and its community just keep giving! Thank you @ccstone for sharing this shortcut. :ok_hand:

This is gold, thanks!!

Can I suggest putting this in the FAQ or "How do I ..." section of the manual?

1 Like

Hi..i am a newbie, and most likely am doing several things wrong. i purchased the software, and was hoping someone can guide me, to make this exact same challenge work for me as well.
on my side, none of these steps from Chris worked... not the first, not the second, not the third etc.

I am also being prompted from a twitter post to choose an image ... which then looks like the very same interface window as vkostas screenshot above, then these Chris steps here do not resolve anywhere...

all this twitter post pop up window is asking for, is for me to pick a file to upload...
and there is nothing that has worked so far...

Did the software change and thats why these steps from 2016 do not work anymore ?

The only thing that has changed is if you on MacOS Monterey the steps after pressing ⇧⌘G are very slightly different. But if you are using an earlier version of MacOS nothing has changed.

To confirm, when the dialog asking for you to select a file pops up, you are saying that ⇧⌘G does nothing?

Could you take a screenshot of the dialog? It has to be a standard MacOS dialog for the technique to work as ⇧⌘G is the inbuilt Mac shortcut for "Go to Folder..."

hi... thanks so much for responding so fast.. let me explain... there are 3 individual keystroke action i had to use to do these ⇧⌘G, so each of them individually.

then all that happens is that in the file chose popup window from nothing being selected, it selects one of the files in that folder.
that folder is a random folder as well from a previous manual step.

these 3 keystrokes, but executed individually after each other and in 3 individual action steps that is, ⇧⌘G , did not do anything, let alone i was in the wrong folder anyway.. so i assume choosing the right file from the right folder is the challenge here for me..

let me add 2 screenshots... the macro is working correctly only until this choose pop up window shows up.... but it it is not the correct folder ....neither...only the last one used..
Bildschirmfoto 2022-07-15 um 19.27.41

You press all three keys at the same time. Not one after the other.

So, while holding down ⇧⌘ press the G key.

i do understand that this is how it would work, when doing this manually with my own typing. without macros, without actions, without using this software.
when i use this software this does not seem to be possible for one, and more importantly , i am faced at a popup window, which asks me to select a folder and a file. this is the part which i try to have an action do..

i was now able to make one single action step with these 3 keystrokes, yet it stops at the very same place as before: At the Popup window waiting fro me to choose the folder and file..
Bildschirmfoto 2022-07-15 um 20.56.21

Try inserting a pause before the Shift-Apple-G keystroke. (.5 seconds should do) Keyboard maestro can execute actions very quickly and a lot of times it's too fast! This works for me choosing a file to upload via twitter from the web browser:

Are you on MacOs Monterey?


after shift command G there is no continuation , no window to enter the path, even with pauses of 5 seconds everywhere. it seem the bar on the left of that popup window is greyed out..althought safari is in the foreground, and although i added activate safari as well as put safari into the foreground, that left side is greyed out.
only if i step in and use my mouse to click on that window, the left side is activated...then actions work a charm.

In which case the Macro will be slightly different. Here is an example that works for me. (You would need to set it a hot key and run it from when you are in the standard Mac dialog, the one that is asking you to navigate to a file).

EXAMPLE Monterey Go To Folder from Save Dialog.kmmacros (2.8 KB)

your macro ads a popup window and a preview of that file with the app called preview ... but that problem persist, where it is stuck in limbo, having that left side greyed out...
maybe i need to change your macros with .... to Safari from default application ?
nope that only opens a tab with the target image

No, that is not what I uploaded. This is the example I uploaded, which has different Actions:

Where you have put an Action to Open the path with Safari, I have an Action that Types the path. In other words, the way this simple Macro works is:

  1. Simulates ⇧⌘G, which brings up a popup for a path.
  2. Types the path you want
  3. Hits Return to go to that path in the dialog

If you click on the link to the Macro I uploaded it will download to your Downloads Folder. Then, if you double-click the downloaded file it will make a copy of my Macro in your copy of Keyboard Maestro. From there you can check out the Actions and copy/paste/edit to your needs.

i think i found the error, and am able to now make it work.
the inactive popupwindos could be activated with a return keystroke , then all your amazing steps could start correctly... before,.. that window to choose folder and files from, was disactivated, even though Safari was in the foreground ... that very window to chooses files and folders was greyed out on the left side... this is a contradiction to Safari being the foreground app.. i have never seen this contradiction before...and i could not manually replicate this contradiction neither. Somehow MAESTRO created this... not sure how though..

1 Like