You can try using
Where si myPalette your variable name for ScriptUI palette.
Unfortunately, there are some issues on MacOS when update is happening too quickly.
Hope that helps.
With CS5 or later you could do "time slices" - e.g. one iteration of your main loop - within an idle event handler.
The update call made the window redraw, but I still could not interact with it.
The main loop would not exist in the same way then, right? I would have to keep track of the current item in another way and find a way to "go to next" item without really having a loop. Since there is recursion involved (digging through an XML document) I guess this would be a bit of a problem as well – keeping the "position" and variables intact between the onIdle events.
I haven't tested this yet, but I guess another problem would be that the "sleep" for onIdle would have to be long enough for the user to click on a button, and setting sleep to a number that is not very small would hurt performance (the total script time would increase).