I have a macro that goes to a program, opens the file menu. Next, I want to select a file name, click Ok and then have the macro continue. Can’t work out how to do that!
What do I need to do?
I am new to keyboard maestro but absolutely loving it. Coming from a Windows background, the apps on that ecosystem cost like £1K up to get the same kind of functionality.
I have a macro that goes to a program, opens the file menu. Next, I want to select a file name, click Ok and then have the macro continue.
If you want to get the full path to a file, you can use this custom plugin:
UPDATED TO VER 0.3 ( adds custom prompt text for the choose file(s) dialog)
Section on Custom Plugins in KM Help File:
(note that to update a plug in action you must manually remove it from the ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions folder before re-installing it)
Choose File(s).zip (10.7 KB)
Custom Keyboard Maestro Plug-in
0.3Adds custom prompt text
Launches an OS X file chooser
Once you have the filepath, you can open the file using:
Open a File, Folder, or Application in the
Open Action Category.
To have a macro wait for you to do some manual action, you have two choices:
Break the macro into two macros, trigger one, do your manual stuff, trigger the second one.
Include a Pause in the macro that pauses until some condition is met and then continues.
The first one is obvious enough, the second has many variations:
You could pause until some detectable condition occurs (eg window title or window size or whatever) that happens at the end of the manual stuff.
You could pause until a modifier (eg the control key) is pressed and manually press a modifier at the end of the manual stuff.
You could set a variable to 0, then pause until it becomes one, and trigger a macro at the end of the manual stuff to set the variable.
The ideal one is the first option - if Keyboard Maestro can somehow detect when you have finished your manual stuff, then that makes the whole process automatic and magical.
The others all require you to perform some sort of action at the end to indicate that you are finished and that the macro should continue.
I have often used this approach.
Do some actions, then display notification, Press "RETURN OPTION to continue."
So the macro pauses until that keystroke is pressed.
Of course you can use whatever combination of key is intuitive to you to mean “continue”.
Hey, some great ideas there. I like the display notification and then press a key combo idea.
In my case, I will be pressing a button labelled Open on the popup choose file box. Is there a way to check for the condition of that button being pressed (after I have highlight the filename)?
AutoHotkey is free and very powerful.
ccstone, yes, I have used AutoHotkey before. I even bought Automate 5 many years ago. But this project is on OSX.
Yes. I got that from the top.
But tell your PC friends about AutoHotkey – it’s a killer-app. :sunglasses:
I looked again at Automate, but it now costs thousands of pounds. I was gob smacked!
AutoHotkey or Autoit were going to be my main tools of choice until I found out about Keyboard Maestro. I bought an expensive iMac but it has ended up as a glorified TV! But, it has some great built in macro language stuff with applescript and Automator (and Alfred!).
You may be able to use a change in the current WindowName to trigger the Pause Until action.
Here is what I did using the SnagIT app:
At this point I manually completed the Save As operation, changing folder and setting the file name.
I then click on the "Save" button, which closed the window, and then the KM macro continued:
You may have to play with the WindowName method to fine tune it for your setup.
Thanks for that. Unfortunately, it doesn’t show the file chosen in the Window title. I am using wait until Ctrl is pressed and that is doing the job ok for now.