Progress Bar Step? KM 10.0.2

Progress Bar Step? KM 10.0.2

I'm trying to learn how to control the new "Display Progress" action. This macro works by sprinkling instances throughout a targeted set of macros.

Keyboard Maestro Actions.kmactions (6.8 KB)


Image 1

image
Image 2

Image 3 shows all the related macros required to implementation the current "Progress Bar":


Image 3

What am I missing? This works but is cumbersome to maintain (see Image 2). I would like to find a way to place the "Progress Bar Step" one time and have it update with the "Currently running SubMacro Name" in its title. Right now I'm using token: %ExecutingMacro% which is static once the Progress Bar starts.

Hi @rcraighead

What you have posted seems very complicated and I don't think you need to make it so complicated.

The new Progress Bar in KM10 is an Action that can be placed at a few key points in any Macro. There is no need to put it in a separate Macro. In fact, I think it is designed specifically to get rid to the need to call sub macros to make progress bars.

Its unique property is that every time it is called (from an Action) it closes its previous instance. Before the dedicated Progress Bar Action existed the only way to achieve this was to call another Macro.

So, the way I've been using it is:

Put a copy of it at the various stages in the Macro where you want to get progress. If you have four key points in the Macro, you could give them rough percentages like 10%, 50%, 75%, 99% and then 100% at the end of the Macro to close the Progress Bar.

That will work and give a graphical indication of progress

But a nice feature is that the % can be a Variable. So I have some Macros where I don't know ahead how many steps there are going to be and the Macro itself calculates the number of steps, divides that by 100 and feeds those values to the Progress Bar. All within the single Macro and no need to call a Sub Macro.

@Zabobon, thanks for the reply. Does your method provide feedback in the Progress Bar title of the current macro running? If I understand, I still need to add multiple instances of the action. Then why not use a customized subMacro? How does it calculate the number of steps? Do you add the variable in each instance of the PB action? How does that make things easier?

There's a lot of ways to use a progress bar action (even a method to make it slide back and forth indefinitely), but here's the way I use mine.

03) Show incremental progress bar.kmmacros (12 KB)

Macro screenshot (click to expand/collapse)

On certain macros I actually use a global DND_ variable to permanently track how many steps the macro has and use that to run the math, but that is a lot more involved to set up.

For most macros this method is sufficient and easy to set up as all you have to do is count how many actions you have (or a close approximation) and set that in a variable at the beginning of the macro. Then you duplicate the Show incremental progress bar actions group in between each of those actions.

This method will also show the name of the currently executing macro in the progress bar.

Let me know if you have any questions about it.

EDIT: Added a gif image to show how it works (obviously these are arbitrary numbers designed to show the result). I just added the show incremental progress bar actions group to a repeat action to give the effect of executing a long macro

incremental progress bar

-Chris

4 Likes

Thanks for the example, @cdthomer. I can't use a local var since my Progress bar spans multiple macros, but you've given me some good ideas.

1 Like

You're welcome! If a local variable won't work then an instance variable likely would. :+1:t2:

Or even global variables that were deleted at the end of the macro's execution (if you’re like me and hate having unnecessary variables lingering around haha).

Yes, the macros delete all non "DND" vars between each "locked order" in our case.
I find it curious that the prefix number is not deleted when called by %ExecutingMacro%. Not a big deal.

Question: If you have to set "pgStepPercent" between each bar update why not make the "Display Progress" and "Set Variable" actions a sub macro?

Another challenge I have is that there may be various numbers of actions/macros during a given "Progress Bar". If the pre-set "total" is not reached the bar does not disappear. In my solution I end with a different submacro that closes the bar regardless of the current percent.