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.
I forgot to ask - do you get this error when you run any of the "Example" macros? If you don't get the error in the Example macros, then it might be the parameters you're passing (maybe I have a big handling them). Let me know.
Otherwise, the error doesn't make any sense to me, because the use of ?? has been around a long time. And since nobody else has reported this error, it makes me wonder what's different on your system.
However, you can try changing the line to this:
var value = params[name];
if (!value)
value = "";
Although I doubt it'll make a difference, since the problem is probably actually caused by something else.