Update a variable in a Custom HTML Prompt window?

I'm semi-proficient with HTML Prompts, having used them in several macros. But I'm trying to figure out something that seems it should be simple, but I can't get it: I want to update an HTML prompt with the value of a variable over time: When the variable changes, I want to update the window.

I found a very promising thread here:

User chazwhiz even posted a screenshot of code that was implied to work. I've attached my version of the code here, as it's just a screenshot in the other thread:

Dynamic HTML window test.kmmacros (3.3 KB)


Despite what's written in the other thread, the window never updates, it just sits there. Can someone let me know what I'm doing wrong?


Per the wiki:

The [Custom HTML Prompt] action will wait for the window to complete before continuing unless you turn on Asynchronously (v8+) in the gear :gear: menu.

So your macro was simply never reaching the loop.

Also, you should move the Pause action to the top of the loop, otherwise the first time the loop runs it will fail on the Execute JavaScript action because the (now asychronously created) HTML Prompt hasn't quite been created yet.
Alternatively, you could uncheck "Failure Aborts Macro" on the Execute JavaScript action, but that might cause some different headaches down the line.

Here's your macro with the required changes:
Dynamic HTML window test.kmmacros (3.4 KB)

1 Like

Oh, the prompt part ... totally missed that when I read through it.


1 Like