[JMP 17.0.0]
I have a project file I’ve been working on that has many data tables, each with a relatively long-running script I use to generate a journal as output. I have a separate script in another table that calls each of the individual table scripts, then collates the individual journals into a single journal to create a final report. [I probably could have made this approach a lot cleaner, but I’m not a full- (or even part-) time coder.]
I wanted to implement some kind of “X of Y completed” update progress bar / message box to keep track of run progress after execution of each individual table script.
This is the story about how I came to my current solution.
TL;DR – After spending a day coming up with a clever-to-me-alone approach, I came across Caption(), which would have been the easiest thing to do.
But I still have some general questions about how windows can be manipulated within the project environment – so stick with me if you’re interested.
There are several great implementation ideas I came across while searching Discussions, including:
https://community.jmp.com/t5/Uncharted/Progress-Bar/ba-p/21160
https://community.jmp.com/t5/Uncharted/Progress-Bar-with-Cancel-Button/ba-p/433560#U433560
https://community.jmp.com/t5/Discussions/Suggestion-on-how-to-script-a-small-update-progress-window-...
However, when I try to implement these solutions within a project environment, the new progress bar that gets created is always created as a new tab in the project. When the next script in the series starts, the progress bar window gets buried by the subsequent data table manipulations associated with the script, so you never see the updated progress message.
General Question #1: I can’t figure out how to create a “pop-out” window as a message box without it being a modal window. My understanding is that modal windows pause the script until the user has interacted with the window, which is what I don’t want. Is there something I’m missing about how I can create a new non-modal window as a “pop-out” instead of as a new tab?
[Again, I realize now that there is such a thing as Caption(). But I still have this general question about whether all new windows in a project have to be opened as new tabs as opposed to a pop-out window.]
General Question #2: Then I thought…maybe there’s a way to dock this newly created progress bar window to another location in the project layout so that it’s separated from the rest of the action – e.g., New Window() << Dock( “Right”). But I haven’t been able to find anything like that. Is there a way to script docking location of a window?
Then I spent a bunch of time learning how project layouts work and how they can be scripted. I learned a ton from that exercise. In the end, I came up with a script that temporarily changes the project layout to replace the “Recent Files” window with a custom “Progress Update” window that does what I’m looking for, and then reverts back to the “Recent Files” window. As you might imagine, it’s a pretty clumsy script, but it gets the job done. I tried to generalize it as best as I could and have attached it here in case anyone is interested to see how it works.
At some point in the day I realized that maybe there’s a way to make this work by forcing new windows created by the individual scripts to be invisible, so that the progress bar window would stay on top. But that would have been better done had I thought of it up front. At this point I would have to make a couple hundred script edits to achieve this option (if it’s possible).
After all that, I came in to work this morning to tell you all this story, and almost immediately came across Caption() – which does basically everything I wanted to do in two succinct lines of code. I just wish I had realized that earlier. I guess if you really wanted to have a true progress “bar” and not just text, maybe Caption() wouldn’t work. But I didn’t really need this to be that fancy.
Thank you for listening.
Joel