MACRO: Floating Progress Bar (Custom HTML Prompt) v1.5

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!

That's funny - I happened to just sit down to the computer and see your message, and while I was typing a reply, I saw your "Solved" response.

Do I remember correctly that KM imports the group disabled? Let me know, because if so, I'll update the installation instructions.

1 Like

Yes, the import leaves the group disabled!

1 Like

@DanThomas just one question:
When comparing the parameter number with the Max number, does it hide even if it exceeds the Max number?

i.e. If I don't know the exact number of times it'll loop, say I put "Max 3000", but the times it really looped were 3100.

Edit: Ah never mind, the action is set to close the window, great thinking! :100:

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).

1 Like

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.

One thing that concerns me is the size of the Keyboard Maestro macro file (plist and sync). In Why Is the Keyboard Maestro Macro Editor Slow & Laggy?, Peter wrote:

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. :sweat_smile:

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.

1 Like

New version 1.2 (which is now a .ZIP file) is in the first post.

Changes are listed in the first post, also.

Barring any bugs, I expect this to be the last update. Famous last words.

2 Likes

:slight_smile:

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!

2 Likes

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).

Anyway, something like that.

This is AWESOME!

I've had learning Custom HTML prompt on my Someday List in my ThIngs ToDo Apps for almost a year. This may be the kick I need to get started!

1 Like

Hey Dan, another great macro! Thanks for sharing.
:+1:

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

  1. Window Title is set to the name of the Macro which called the Progress Bar
  2. 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.
  3. Cancel Button is enabled
  4. 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.

Thanks.

2 Likes

Dan, thanks for providing the "Cancel Button".

Enhancement Request

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.

This can be done using the Cancel a Specific Macro Action.

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:

  1. Name of the Parent Macro that called the Progress Bar
  2. `%ExecutingInstance% of the Parent Macro, which could be assigned to a Progress Bar JSON field.
  3. 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?

Thanks again Dan.

I came across that post yesterday, so I know exactly what you're talking about. :grinning_face_with_smiling_eyes:

It turns out that you can achieve what you want by setting CancelMacroParam to %ExecutingInstance%.
image

Then you can have a general-purpose macro that uses %TriggerValue% to know what instance to kill.
image

If I release a new version, I'll include this in the examples and/or Help file.

2 Likes

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.

4 Likes

Hey Dan, just got around to updating to Ver 1.3, and I'm getting this error:

image

I did delete the Macro Group and all macros of Ver 1.2 before I imported Ver 1.3.

How do I fix?

EDIT:

Just to make sure, I did it again:

  1. Delete Progress Bar MG and all macros
  2. Reload KM and KME
  3. Import from KM menu

Same error.

EDIT 2:

This looks like a JavaScript error in your HTML file for the "Show" macro.

Don't know why you're getting that error. Try right-clicking on the window, "Inspect", and view the Console to see if it reports any errors.

Hi Dan,

Right-clicking on the window yields this:

image

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.