Hi @DanThomas - this looks like a great and very useful macro set! Thanks.
I was just playing around with it and ran into a problem. I ran Example 4 but clicking the Cancel button didn't do anything - the progress bar just kept cycling up and down.
I checked the UUID of Cancel Button macro and that seems to be in order so I'm not sure what's going on.
SOLVED: - I forgot to enable the macro group. Once I did that everything worked great!
Yeah, the progress bar max and value aren't related to anything else. You have to close it yourself. You could even restart the count if you wanted to, or set both Max and Value to blank (try it and see what happens sometime).
Thanks for this, Dan. I only needed an indeterminant progress bar for Mirror Mirror Macro, so I made a lightweight variant that conforms to that macro's color scheme.
The editor is designed for a relatively small set of macros (<1000), a relatively small macro file (<2MB), and relatively small macros (<20 actions). This is the typical usage. It is not designed to scale arbitrarily to unlimited size, any more than Notes is designed to write your next novel in.
When I added this macro group (which I realize can be pared down quite a bit after you learn how to use the progress bar), my Keyboard Maestro file grew to 3.4-MB from 1.1-MB.
I'm not sure how important a <2-MB Keyboard Maestro file is, but I'm afraid to find out.
The size is because of the help macro. Feel free to delete it. If you want to save the help, paste it into TextEdit and save it.
Contrary to what I said above, I have one more release coming, so I'll put the Help into a PDF. That way it won't get loaded with the macros. Thanks for the heads up.
Yep, I have found that is best to minimize the use of images stored within a macro.
KM stores all images as TIFF format I think, which really bloats the monolithic master macro plist file.
Thanks for this great macro. I have a very long macro using it and it works quite well.
Now, as anybody trying to work with this kind of long macro, I often have to debug or fine tune one of the steps, and while the SubText parameter and the cancel parameter are great I think a way to pause things would be really useful.
The way I see it is if a Pause parameter is "on" the update macro would pause things and make a "Proceed" Button appear next to the cancel button.
I think it would make step by step debugging a bliss (well...yes...)
I have built a debugging system called Checkpoint for KM that includes pause/stop/continue as a feature (and much more besides). I am considering releasing it into the wild but… I will be posting about it soon. Sorry to be a tease!
First, don't forget that KM has a Macro Debugger, which might be what you want. With that said:
You can use the Cancel button for whatever you want. Just because it's called Cancel doesn't really mean anything. And in fact, with version 1.2, you can change the button text to something else.
So you can use that to come up with a way to pause and resume the main macro. Perhaps set a variable that the main macro checks periodically, and pauses (maybe show a Prompt).
As an alternative to setting each of the JSON parameters in a separate KM Action, I'd like to offer this single Action to set all parameters:
ACTION: Set All Parameters for Progress Bar
Set All Parameters for Progress Bar.kmactions (959 B) NOTE: When this ACTION is imported it will be auto-inserted into the Macro currently selected in the KM Editor app, after the Action that is currently selected.
My Custom Settings
Window Title is set to the name of the Macro which called the Progress Bar
The Window will be positioned at the current Mouse location
This can be easily improved to center around Mouse,:
MOUSEX() - 150
MOUSEY() - 75
OR center on active, frontmost screen.
The default is to center on MAIN screen, which may NOT be the front most screen.
Cancel Button is enabled
You need to change the "CancelMacroUUID" value to your Macro UUID
One Request
Change your HTML Prompt code to ignore a Parameter if its value starts with "TBD".
This would allow us to leave those Parameters in the JSON for future reference and ease of change.
However, rather than calling a specific Macro that is unique to the Parent Macro that called the Progress Bar, I would like to have an option to "Force Quit" the Panent Macro.
The use case for this is a runaway script in the Parent Macro, or even a KM Action block that contains some Action that is hung up, not responding.
Here's an example:
I would like to have one macro that is always called by all Progress Bars when the Cancel button is pressed.
To make this work, I need to pass the following parameters to this general Cancel Progress Bar:
Name of the Parent Macro that called the Progress Bar
`%ExecutingInstance% of the Parent Macro, which could be assigned to a Progress Bar JSON field.
Name of Global Variable to set to flag cancellation.
This would all us to create a unique variable for each Parent Macro.
Even better would be to use an Instance Variable, but I'm not sure that is possible given the process flow of Parent Macro > Progress Bar HTML Prompt > Cancel Progress Bar macro
@peternlewis, could this be done with Instance variable?
Just released version 1.3, which you can download from the first post. See the changes notes there.
This release was a lot of work, so please let me know if I broke anything. Obviously I don't think I broke anything, but after a while my brain started to fuzz over, so you never know.
Does not show any errors, nor did I expect it to. The Safari JavaScript window just shows the HTML of the window. I've never seen an error reported here. Only when running a script in the debugger do you see an error.
I'm running Keyboard Maestro 9.2 on macOS 10.14.6 (Mojave).
Ver 1.2 worked fine. I'll reload it an test again.