So would you use the WindowName token to return a value of a floating window asking you if you want to save or not that doesn't return a title? I tried UI browswer and was able to see that it was Window 1 and press cancel but I am trying to make Keyboard Maestro wait until it displays that window before pressing cancel.
activate application "Microsoft Excel"
tell application "System Events"
tell process "Microsoft Excel"
click button "Cancel" of window 1
I know I can use this but would like to find out if every window has a referenceable name or ID for Keyboard Maestro?
Good to know, I will stick with the Pause Until then.
Me too, this is very cool and I'll keep this on hand to use as my building block for future macros. I will no doubt use this quite often!!
Thanks for typing "currently maybe" your visuals were very helpful.
Sorry to ask the painfully obvious but I have made too many wrong assumptions in the past about things.
Step one is not needed for this. I would run step one alone first before I make the macro and then turn it into steps 2 - 4 by themselves right?
Running this macro as is really only is needs step 2 & 4 (steps one and three are just extra, though they are my question of course). No reason you would ever run a macro like this right? I know you were giving it to me as an example of which I will use often but just wanted to be sure.
Wrong. Step 1 is required, getting the name of the window BEFORE the popup window appears.
You need this when the popup window does NOT have a name, like in my example.
Wrong. While this is just an example, it is a real-world example. Obviously the conditions/criteria under which you might use this pattern will vary, and therefore you will need to adjust the macro accordingly.
If you know the title of the popup window, then you would change the “title is not” to “title is”, and enter the actual title of the window. You would NOT use the KM Variable.
Step 4 is the action that you want to perform when the window appears. In this case I want to “cancel” the attempt to quit Excel.
I did NOT type “currently maybe”. That was displayed by the KM Editor, and the screenshot just skewed it for some reason.
Yup, absolutely I tried everything I typed about, searched the forums and Internet and have macros set for that before I bother people. Sometimes I just don’t even know what to search for like Chris’ awsome post of getting the front window (list of windows Keyboard Maestro can see didn’t occur to me to search for). I thought all my conclusions were correct based on my testing. I still have no idea how you got “Currently Maybe.” I have run it with the quit window open already, without it open and watched the macro along the way and only get “Currently True” or “Currently False.” I don’t know how Currently Maybe is even possible.
Yup no problem, I actually don’t want to quit Excel though and really just wanted to focus on how to properly identify the save pop up window in Excel. For some reason with some VBA I run it only works once I quit and then escape which most defiantly would be a new thread. Sorry for hijacking the thread to focus on getting a window name, I see how it works though in any application which is very helpful. My apologies for being too specific in using Excel in this case.
Currently Maybe shows up before Keyboard Maestro editor gets an answer from Keyboard Maestro Engine as to the true/falseness of the condition. So you should generally never see this, and it will usually indicate a problem with the editor communicating with the Keyboard Maestro Engine (an issue that the Assistance window checks). Either the Keyboard Maestro Engine is not running, or some problem communicating with it has happened (which I suspect happens when something goes wrong with the interprocess communication system).