If you are programming a sequence of actions in Lua you will soon realise that the Helm user interface does not update until the script is finished. That makes sense under most circumstances for reasons of efficiency. However, if you do want to make lights flash on and off for example you need and extra Lua command helm.idle(). Here’s an example of how to use that.
Very simple. A set of indicators which we will try to change colours as the script runs. And two buttons with scripts that illustrate the difference.
Script that does not update
This script changes the CurrentPicture parameter of the Indicators at intervals. But you see nothing happening. ( By the way, note the “Indicator_*” notation. You can use wildcards like this to drive several objects at once ).
Script that works
Now we’ve added helm.idle after each change which causes Helm to update the display to reflect the new values.
And now we have the desired colour sequence effect. You can download the sample panel here to see all this in action.