show the progress of script in the progressBar

User 247c00dc1d

18-02-2015 08:33:14

Hi,


How can I show the progress of my script process in the progressBar of main window of IJC (in the bottom / right)? Instead of ProgressBar Style Marquee.


now I use writing a string into log window by:


if (good % 10000 == 0) {def now1 = new Date(); println now1.format("HH:mm:ss") + ' exported: ' + good + ' items ('+ ((good*100)/rows).toDouble().round() +' %)';

Thanks!


Igor



ChemAxon 26d92e5dcd

23-02-2015 09:14:37

Hello Igor,


Each script gets its own progress bar, which says 'Running script XYZ' and shows an indeterminate progress bar. Unfortunately a script has no access to this progress bar. What you want could possibly be achieved by creating a new progress bar from the script. Here is a code snippet that shows the concept. Please create a new schema script and copy paste this code snippet there, save and run. You should see an extra progress bar.


def env = EnvUtils.createDefaultEnvironmentRO('My background work', false)

env.feedback.switchToDeterminate(1000);
try {
    for (int i = 0; i < 1000; i++) {
        env.feedback.progress(i)
        Thread.sleep(10)
    }
} finally {
    env.feedback.finish()
}

 


Wishing all the best


David

User 247c00dc1d

23-02-2015 10:02:08

Hello David,


Great, thanks a lot!


Igor