Hi all,
is there a way to react on clicking the close button "X" of the "Display Progress" window? I would like to abort my macro, if the progress bar gets closed manually.
I searched the forum and the documentation, but I find nothing on it. Maybe I am missing something general?
The closest you can get is to do it the other way around, by having a Macro and hotkey set up that aborts all Macros, which effectively also closes the Progress Bar.
It is also possible to close the Progress Bar by having an Action that sets it to 100. So, if the Progress Bar is part of a loop and you break out of that loop, you can follow that with an Action that sets the Progress Bar to 100 so that it closes automatically instead of having to click on the "X".
But clicking "X" does nothing other than close the Progress Bar window once the last Progress Bar Action has been reached.
First note of caution -- this is bad UI design. Closing an "information" window shouldn't cancel the operation it's informing about -- cf the Finder's "Copy" window, with its separate "Cancel" button.
Second note of caution -- I've had nothing to do with KM's "Display Progress" action, so what follows should be taken with a huge handful of salt, and tested to destruction...
"Display Progress" is an Engine window, but doesn't seem to return a `%LastWindowID%, so it looks as though you can't test for its presence. Except you can, using AppleScript:
tell application "Keyboard Maestro Engine"
return every window whose name is "Keyboard Maestro Progress"
end tell
...returns eg {window id 13093 of application "Keyboard Maestro Engine"} when there's the default-titled Progress Window is open and {} after it has been closed. So you might be able to include such an AppleScript action in your script on the assumption that if the Progress Window is absent and macroProgress < 100% then the user has closed it so abort the macro.
As I say, totally untested -- but it might get you somewhere...
Hi all,
I appreciate your feedback. Currently I am using the progress bar, so show remaining time before the computer is put to sleep. It crossed my mind that closing this might be an easy way to stop this, if I change my mind. I agree this should be no standard behaviour of a sensible UI. But I suppose many macros (not only mine) are quite non-standard.
Maybe I build a better version, the progress bar seemed like an easy shortcut (at first)