Dynamic dialog with realtime variable info?

Is there a way to make a dialog that displays realtime info being created by a running macro? For a simple example a macro that sets a random number every few seconds, and would show me a persistent window with the current number...

Not multiple windows like the Display Text action, and nothing I have to refresh - just a constantly updating display of the variable's contents?

Note: I realize a random number generator could be done in something like Javascript and shown in custom HTML dialog, that's not my actual use case, just an example. My use is basically to show me a constant readout of data from several variables being updated by several looping KM macros that are looking at images and reading log files. The macros all work fine, I just can't currently see what they've done until they stop.

Hey @chazwhiz,

The simplest way to do that is going to be to use BBEdit and AppleScript.

Set up a BBEdit window where you can see it, and update the given variables.

I could show you how to do this in about 5 minutes if you'll give me some example output names.

Note that while BBEdit is commercial software the Lite version is completely free. The full-featured demo runs for 30 days and then reverts to Lite, and the Lite version is fully scriptable.


You can display a persistent window in Keyboard Maestro using the Custom HTML Prompt action.

Something like this:

You can use the Execute a JavaScript in Custom Prompt action to execute a JavaScript in the persistent window to update the display any way you like.

I think part fo the problem is that I don't really "understand" JS - I can work with it, but am pretty dependent on documentation. And obviously it's not your job to have detailed JS docs, KM is just a conduit to what the JS can do...

So in the countdown example I looked at it and it seems like KM is passing in a starting variable, but then it's just pure JS doing the math etc to output the updated results? Originally I was thinking that doesn't help me if all the work is happening in KM.

But that Execute JS in a prompt action - So basically I need to use that to perform the updates. Like step 1 of my macro might be to create the base HTML prompt (and that needs to be set to async right? so the macro keeps going after the pop up?) and then later in like step 5 when an action will result in a KM variable change, I then have an Execute JS action that will send the new var to the existing prompt and (if I write the JS right) result in an updated prompt window?

I'm going to go mess with it and see if I can get a basic version working to make sure I get the concept...

@ccstone Thanks, but I'm looking for a way to do this all within the macro. Currently I'm just writing to log and tailing it to do pretty much the same thing you're describing.

Alright, I think I get it... something like this?

1 Like

Looks good to me, is it working and doing what you want?

Seems to be! The macro I'm integrating it into is of course a lot more complex so it's taking a bit of time (plus now keep getting distracted trying to perfectly style my prompt!). But I've got a basic structure working by basically replacing all my existing Log actions with Execute JS like the above.

Thanks for the help!

1 Like

Hey @chazwhiz


I mistakenly thought you didn't want to use a Custom HTML Prompt action.


Could you please post your Macro file?
I think this would be of great help to many of us.


I have followed your macro to the T - making sure I didn't mistype anything. I get the logic, etc, but I can't get it to work. Dialog pops, but the content isn't dynamically updated. Can you post your macro?