Progress bar to update as script runs

Hi, I'd like to have a progress bar being displayed as my script runs. I created a simple progress bar as follows:
var win = new Window("palette", "SnpCreateProgressBar", [150, 150, 600, 260]);
win.pnl = win.add("panel", [10, 10, 440, 100], "Script Progress");
win.pnl.progBar = win.pnl.add("progressbar", [20, 35, 410, 60], 0, 100);
win.pnl.progBarLabel = win.pnl.add("statictext", [20, 20, 320, 35], "0%");
win.show();
                    while(win.pnl.progBar.value < win.pnl.progBar.maxvalue)
                              // this is what causes the progress bar increase its progress
                              win.pnl.progBar.value++;
            win.pnl.progBarLabel.text = win.pnl.progBar.value+"%";
                              $.sleep(10);
    alert('Done!');
win.close();
Now, if I target the ExtendScript Toolkit, I can see the "animation" of the bar progressing. But If I target illustrator, I only see when it's at 0% and then it jump to 100%. Is there a way to update the information visually as the script progresses?
Thanks!
I'm running CS6 on mac.

Hi,
i was using the above code in my application but it is displaying the following message when i run it:
Can you please help me out.
Thanks
Harsh    

Similar Messages

  • Script : How to add a progress bar to XMP Writing script ?

    Hi !
    I have this script that works flawlessly but when i execute it on big video files ( > 1GB) bridge doesn't repaint and it looks like it's stuck. I would like to have a progress bar showing % remaining on the task and the name of the file being treated. Can someone point me into the right direction as my adobe scripting knowledge is not that great.
    #target bridge  
    if( BridgeTalk.appName == "bridge" ) { 
    descToTitle = MenuElement.create("command", "Log Comment to Description", "at the end of Tools");
    descToTitle.onSelect = function () {
               if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
               var thumb = app.document.selections;
               for(var s in thumb){
                         if(thumb[s].hasMetadata){
                                            var selectedFile = thumb[s].spec;
                                            var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
                                            var myXmp = myXmpFile.getXMP();
                                            var LogComment = myXmp.getProperty(XMPConst.NS_DM, "logComment");
                                            myXmp.deleteProperty(XMPConst.NS_DC, "description");
                                            myXmp.appendArrayItem(XMPConst.NS_DC, "description", LogComment, 0, XMPConst.ALIAS_TO_ALT_TEXT);
                                            myXmp.setQualifier(XMPConst.NS_DC, "description[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");
                                            if (myXmpFile.canPutXMP(myXmp)) {
                                            myXmpFile.putXMP(myXmp);
                                            myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
                                             } else {
                          xmpFile.closeFile();
    Thx in advance for helping me !

    I am using this progress bar on bridge. I don't remember who gave it to me time ago.
    Anyway I have adapt it to your script:
    #target bridge  
    if( BridgeTalk.appName == "bridge" ) { 
    descToTitle = MenuElement.create("command", "Log Comment to Description", "at the end of Tools");
    descToTitle.onSelect = function () {
        if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
        var thumb = app.document.selections;
        var progBar = new createProgressWindow("Work in Progress", "Please wait", false);
        for (var s in thumb) {
            if(thumb[s].hasMetadata) {
                var selectedFile = thumb[s].spec;
                var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
                var myXmp = myXmpFile.getXMP();
                var LogComment = myXmp.getProperty(XMPConst.NS_DM, "logComment");
                myXmp.deleteProperty(XMPConst.NS_DC, "description");
                myXmp.appendArrayItem(XMPConst.NS_DC, "description", LogComment, 0, XMPConst.ALIAS_TO_ALT_TEXT);
                myXmp.setQualifier(XMPConst.NS_DC, "description[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");
            progBar.updateProgress (Math.floor((Number(s)+1)*(100/thumb.length)), "Waiting, " + Math.floor((Number(s)+1)*(100/thumb.length)) + "% completed.");
            if (myXmpFile.canPutXMP(myXmp)) {
                myXmpFile.putXMP(myXmp);
                myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
            } else {
                xmpFile.closeFile();
    function createProgressWindow(title, message, hasCancelButton) {
        var win;
        if (title == null) title = "Work in progress";
        if (message == null) message = "Please wait...";
        if (hasCancelButton == null) hasCancelButton = false;
        win = new Window("palette", "" + title, undefined);
        win.bar = win.add("progressbar", {x: 20,y: 12,width: 300,height: 20}, 0, 100);
        win.stMessage = win.add("statictext", {x: 10,y: 36,width: 320,height: 20}, "" + message);
        win.stMessage.justify = 'center';
        if (hasCancelButton) {
            win.cancelButton = win.add('button', undefined, 'Cancel');
            win.cancelButton.onClick = function() {
                win.close();
                throw new Error('User canceled the pre-processing!');
        this.reset = function(message) {
            win.bar.value = 0;
            win.stMessage.text = message;
            return win.update();
        this.updateProgress = function(perc, message) {
            if (perc != null) {
                win.bar.value = perc;
            if (message != null) {
                win.stMessage.text = message;
        return win.update();
        this.close = function() {
            return win.close();
        win.center(win.parent);
        return win.show();

  • Displaying an Indeterminate Progress Bar While a DB2 Stored Proceedure Runs

    How do I display a dialog with an indeterminate progress bar while a DB2 query runs? Could anyone point me to an example or some strong docs?
    I learned Java about six months ago, so I'm relatively new to the language. Through searching and documentation, I've been able to find all the examples and answers I've needed so far. Now I've run into an issue I can't find anywhere. It seems like the most basic thing in the world. I have a DB2 stored procedure that takes about 5 minutes to run. While it's running, I want to display a simple dialog with a progress bar going back and forth (no buttons, no user interaction).
    I'm using Eclipse 3.3.1.1 as my IDE, and running the application from a JAR file. I have Java 1.6.0.30 installed. The DB2 query is running in response to a user clicking a button on the form (an ActionEvent). All of my forms are using Swing (JFrame, JDialog, etc.).
    The crux of my problem seems to be that I can bring up a dialog (which should contain the progress bar), but I can't get it to paint. All I get is a window that's the right size/location, but contains an after-image of what was behind it. I can't even get a dialog to display with a "Please Wait" label while the DB2 procedure runs.
    I tried separating both the DB2 stored procedure and the progress dialog into separate threads. I tried yielding in the DB2 thread to give the progress dialog a chance to update. I tried using invokeAndWait, but I got the following error:
    Exception in thread "AWT-EventQueue-0" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
    It seems like I'm doing something wrong in my use of Theads, but I can't for the life of me figure out what it is. If anyone could help out a bit of a Java newbie, I would be extremely grateful.

    Demo:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ProgressBarExample2 {
        private JProgressBar bar = new JProgressBar(0,99);
        private JButton button = new JButton("Lengthy operation");
        private ActionListener al = new ActionListener(){
           public void actionPerformed(ActionEvent evt) {
                button.setEnabled(false);
                bar.setIndeterminate(true);
                new Worker().execute();
        private class Worker extends SwingWorker<Boolean, Boolean>{
            protected Boolean doInBackground() {
                try {
                    Thread.sleep(10000); //10 secs
                } catch (InterruptedException e) {
                return Boolean.TRUE;
            protected void done() {
                button.setEnabled(true);
                bar.setIndeterminate(false);
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new ProgressBarExample2();
        ProgressBarExample2() {
            button.addActionListener(al);
            JPanel cp = new JPanel();
            cp.add(button);
            cp.add(bar);
            JFrame f = new JFrame("ProgressBarExample2");
            f.setContentPane(cp);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Help with adding a progress bar to my compare-object script

    I have a simple compare object script that I would like to add some kind of intelligent progress bar or countdown timer to.  The script takes anywhere from 1-12 hours to run depending on the folder sizes.  Here is the script:
    $internal = Get-ChildItem -Recurse -path C:\Folder1
    $external = Get-ChildItem -Recurse -path C:\Folder2
    Compare-Object -ReferenceObject $internal -DifferenceObject $external | Out-File C:\compare_list.txt
    I have a progress bar script that I found but I do not know how to implement it into my existing script.  Here it is:
    for ($i = 1; $i -le 100; $i++) {Write-Progress -Activity 'counting' -Status "
    $i percent" -PercentComplete $i ; sleep -Milliseconds 20}
    Any help is much appreciated.

    Hi Brisketx,
    In addition, to add a Progress Bar to Your PowerShell Script, this article may be helpful for you:
    Add a Progress Bar to Your PowerShell Script:
    http://blogs.technet.com/b/heyscriptingguy/archive/2011/01/29/add-a-progress-bar-to-your-powershell-script.aspx
    I hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • URGENT: progress bar update problem

    Hi,
    I have the following problem: I have a JWindow that displays as a Splash screen at the start of my application. On that I have a progress bar that updates upto 60% (there is no task associated with it, I simply create a thread that does this). In the main thread, i wait for this thread to complete and then display a login dialog box on top of the splash screen. At this time, the progress bar is not increasing.
    After logging in correctly, I wish that the login dialog box be disposed, and i should be able to see the progress bar reach completion, after which i want a JFrame to be displayed with a lot of components, and after this JFrame is displayed, i want the splash screen to be disposed.
    However, the progress bar updates itself properly till the login dialog is displayed. when i click enter on the dialog box, although i have called dispose, the part of the dialog box over the splash screen reamins visible, and the progress bar is no longer updated. I have printed System.out.println statements in the run part of the thread doing the update, and this shows that the progress bar value goes on to reach 100. but the GUI is not updated.
    Can any1 explain why this is happening? Any help inthis matter would be highly appreciated... Pls reply URGENTLY!!! i've already spent three days looking into this!!!
    Thanks...
    Shefali Panchal

    Caution with using threads to update the display -
    look at the Swing __utility__ class methods, I seem to remember that
    there are 2 methods in which you pass a thread instance
    (which can contain display update calls)and this is called and maintained within the event despatch thread - this should mean
    that display updates are done correctly.
    Refer to Swing documentataion with regard to utility methods
    Hope this is of help

  • ITunes problems after upgrading - progress bar "updating library"

    after upgrading iTunes to the latest version I open iTunes and a progress bar appears "updating library". After a few seconds it stucks and I do not get a response at all. I have to cancel the program in the Windows Task Manager. Any help is greatly appreciated. Cheers

    You might try rebooting your computer. Select Shutdown and let the computer turn off. Then start it up again and see if the problem is corrected.

  • Update progress bar from repeater events

    I have a component that uses a repeater to download and set information on a collection of items from the internet.  This can take a while, so I tried to set up a panel with a progress bar to provide some feedback.
    Problem is, when the repeater is executing, it apparently doesn't yield time so the progress bar can update. (?!)
    The end result is that the progressbar doesn't show anything until the repeater is done, at which point it shows the last value the repeater loaded.
    So, is there a way to get around this?  Can the repeater be triggered with timer ticks, instead of blindly looping?
    Scouring the docs, but nothing is showing, yet.  At worst case, I guess I can bag the repeater and just fetch the items in a timer driven loop, rather than use the repeater mechanism.  Would be a drag, but I need the progress bar to update.
    Any thoughts appreciated.
    rickb

    Changing to window made no difference.
    One solution is to show the document being built, now its hidden. Another would be to show the progress in a palette.
    I have never built a palette, is it possible to have a swf-file that triggers javascript?
    Is it possible to add buttons to the palette menu on the top right?
    But solving this would be the easiest...

  • Updating Progress Bar

    During the response to a mouse click I want to update a progress bar. I can not get the progress bar to update. If I attempt to update both a progress bar and a slider the slider updates but the progress bar does not.
    code fragment
         class SymMouse extends java.awt.event.MouseAdapter
              public void mouseClicked(java.awt.event.MouseEvent event)
                   Object object = event.getSource();
                   if (object == startButton)
                        startButton_mouseClicked(event);
         void startButton_mouseClicked(java.awt.event.MouseEvent event)
              // to do: code goes here.
              // Increment the current values
                   doCalculations(progressSlider);
         public void doCalculations(HorizontalSlider hs){
                   try {
                        for(int i = 0; i < 5; i++){
                             Thread.sleep(1000);
                             hs.setValue(hs.getValue()+2);
                             progressBar1.updateProgress(progressBar1.getValue()+2);
                   catch(Exception e) { }

    In this code it is a custom class from Symantec (symantec.itools.awt.util.ProgressPar) but I get the exact same behavior using JProgressBar.
    marshall

  • How to slow things down to see the progress bar?

    how to slow things down to let the progress bar to show its progress?
    everytime i run the program i can see only two scenario: 1. 0% 2. 100%
    i think the stuffs are too little to make any difference.
    what should i add in the codes so that i can see the progress?
    thanks!
    here is my codes:
    jProgressBar1.setValue(1);
    do some stuff here
    jProgressBar1.setValue(15);
    do some stuff
    jProgressBar1.setValue(31);
    do some stuff
    jProgressBar1.setValue(41);
    do some stuff
    jProgressBar1.setValue(61);
    do some stuff
    jProgressBar1.setValue(100);

    Hi!
    When you call update on the progress bar, the value of the progress bar is updated, but it won't be reflected on the screen until Swing has a chance to repaint. Swing can't repaint until your code is finished. So, what's happening is something like this:
    setValue(1), do stuff, setValue(15), do stuff, setValue(31), do stuff, Swing Repaint
    Also, not only does this block the progress bar from updating, but as long as your code here is running it blocks all of Swing (repainting, handling events, etc...).
    If your "stuff" isn't very time consuming, just remove the progress bar altogether. Otherwise, to make things work properly, you'll want to move it to another thread. Then, from that thread you can keep the progress bar up to date with:
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            jProgressBar1.setValue(xxx);
    });Hope that helps!
    Shannon Hickey (Swing Team)

  • Proper Progress Bar Technique

    Hi,
    I have been having a few strange issues lately and have done alot of research, but I am confused about the proper way to implement a progress bar that updates as a specific task is being performed. Here is some example code before I explain where my confusion lies...
    public class Test extends JFrame {
    public JFrame DisplayFrame;
    public StatusBar statusBar;
    public JButton button;
    public static void main( String args[] ) {
         Test t = new Test();
    public Test(){
         init();
    public void init(){
         DisplayFrame = new JFrame( "Test Window" );
         DisplayFrame.setSize( 600, 600 );
         statusBar = new StatusBar();
         statusBar.setPreferredSize( new Dimension( 300, 100 ) );
         statusBar.setVisible(true);
         button = new JButton("go");
         button.addActionListener( new ActionListener() {
              public void actionPerformed( ActionEvent e ) {
              testProgressBar();     
         final Container cont = getContentPane();
         cont.removeAll();
         cont.add( button, BorderLayout.CENTER );
         cont.add( statusBar, BorderLayout.SOUTH );
         DisplayFrame.setContentPane( cont );          
         DisplayFrame.setVisible( true );
    public void testProgressBar(){
         statusBar.progressBar.setMaximum(200);
         statusBar.progressBar.setValue(0);
         for ( int i = 0; i < 200; i++ ){
         for( int j=0; j<1000000; j++ ) {
         statusBar.progressBar.setValue(i);
         statusBar.progressBar.update(statusBar.progressBar.getGraphics());
    class StatusBar extends JPanel {
    public JProgressBar progressBar;
    public StatusBar() {
         progressBar = new JProgressBar();
         progressBar.setVisible(true);
         progressBar.setStringPainted(true);
         add( progressBar );     
    Now, when I run this code it seems to work fine, and as you would expect it to. The ProgressBar is updated at the appropriate intervals...However, I have read that updating a part of a swing GUI such as this, should not update at regular intervals but instead should hang until the Event Dispatch Thread has finished and releases its control.
    I am confused as to why this actually works. I have a much more elaborate system with many progress bars where I have been updating them similar to the above example code. I have never had any problems whatsoever, but I am convinced, that I am just getting lucky, and this is a poor way to solve this problem. Anyone have any suggestions to help alleviate my confusion? I would really like to know why this works when it looks as if it should not update unless the progress bar was capable of interupting the EDT in order to facilitate its changes....

    Your code works fine because all of it - excluding main() of course - is running on the EDT.
    But what happens
    - if you overlay your frame with another application?
    - if you try to change the size of your frame?
    The EDT will not be able to process events and your GUI will not be painted and/or layout until your loop finishes.
    Only your progressBar will be painted because you're doing it explicitly.
    If you want to do it right, take a look at SwingWorker or http://spin.sourceforge.net .
    Sven

  • Trying to show a progress bar...

    Helloo!
    I'm having trouble getting my progress bar to update. I post the new control values, but it doesn't get a chance to redraw until either the End, or if I hit a breakpoint using ExtendScript Toolkit.
    It DOES correctly disappear (close) at the end.
    I'm setting a bunch of keyframes in a big loop. Takes a little time, nice to show the progress.
    Oh, I'll show the code too. It's longish, sorry. Thanks for any advices!
    b Caller
    > var pb = progressBar("Setting " + notes.length + " Keyframes");
    for(var i = 0; i < notes.length; i++)
    pb.setValue(i / notes.length);
    tp.setValueAtTime(note.time,note.text);
    pb.close();
    b Progress Bar Handy Object
    >/*
    Easy to use progress bar for ExtendScript.
    Written by [email protected], 2007
    Enjoy, but this credit must remain intact.
    >usage:
    > var pb = progressBar("main title","subtitle");
    pb.setValue(valueFrom0to1);
    pb.setTitle2("new subtitle display!")
    if(pb.isCanceled())
    pb.close(); // they clicked cancel
    function progressBar(title1,title2)
    var result = new Object();
    result.running = true;
    result.p = new Window("palette");
    result.p.orientation = "column";
    result.p.alignChildren = "left";
    > result.t1 = result.p.add("statictext",undefined,title1);
    result.t2 = result.p.add("statictext",undefined,title2);
    result.b = result.p.add("progressbar");
    > result.c = result.p.add("button",undefined,"Cancel");
    result.c.onClick = function() {
    result.running = false;
    > result.isRunning = function() { return this.running; }
    result.isCanceled = function() { return !this.isRunning(); }
    result.setValue = function(x) { this.b.value = x * 100; }
    result.setTitle1 = function(t1) { this.t1.text = t1; }
    result.setTitle2 = function(t2) { this.t2.text = t2; }
    result.close = function() { this.p.close(); }
    > result.p.show();
    return result;

    As usual, thanks, that worked perfectly Jeff!
    (I've gotten a midi-file parser working in ExtendScript, will post soon. Fun fact: adding a keyframe in AE is approximately very much slower than adding a point to a path in Illustrator. Illustrator is fast fast fast.)

  • Progress Bar is not working in Labview 6i

    Hi all,
    i implemented one vi with  Progress bar using labiview 6i. i created property node for the progress bar to set the range as 550 using scale >Range>maximum. progress bar is updating well until the value of 220. later the progress bar is starting from begining. What is the maximum range we can define for the Progress bar.? please see the attached picture . Am i missing anything from the figure?
    thanks,
    kalpana 
    Attachments:
    Progress Bar.png ‏60 KB

    Hi kalpu,
    as your "slide" is of datatype U8 it will not display values greater than 255…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Progress bar for report?

    Hi there,
    Does anyone have any advice on how to display a progress bar while a report is running (PDF report, web, using Reports 6, OAS)? We have the report output pop up in a new dialog browser window. The window pops up, but depending on the report, sometimes it takes a minute or so before the report output is actually displayed in the window. The users are requesting a progress bar to show them that it's working and how far they are from seeing the output.
    Any ideas? Any built-in functionality? Should I bring Forms into the mix?
    Thanks in advance
    Dave

    user-Rachna wrote:
    I created a dynamic action on 'Before page submit' and showed an alert to see if it works or not. But it doesn't work for my report as the report gets refreshed without submitting the page.
    Here is exactly what I have:
    http://apex.oracle.com/pls/apex/f?p=54687:38:109840028367746
    Thanks.
    It would seem to be an obvious step to create additional dynamic actions on the Before/After Refresh events for the report region to show/hide the plug-in loading frame.

  • Dynamic Progress Bar

    I'm creating a page-turning module. Throughout the module
    there is a progress bar that updates both visually and by
    percentage how much of the module has been completed. I'm not sure
    how to program this and help is appreciated. As you can see by the
    mockup I have so far ( below) I've got the progress bar drawn and
    the percentage completed as well as a dynamic text f ield. What I'm
    wondering is how to make it update as the user goes forward (the
    only direction they can go) through the frames.
    http://distance.uaf.edu/mockup/FERPA-mockup-1.html
    thanks!
    sage

    well, you could get the percentage by dividing current pages
    they have been through by the total quantity of pages in the doc
    and multiply by 100. And if this is more dynamic (pages get added
    or taken out) but it's based on 'one frame per page' then you could
    use the _currentframe and _totalframes, within the same type of
    formula to derive the progress percentage.
    you can then advance the 'bar' by: first drawing a bar that
    fills the whole area, at 100%, make it a moive clip, then using the
    calculation you decide on to obtain the percentage, you can use the
    _xscale property, on the 'bar' to scale it to the current
    percentage of progress (set it to 0 at the start).

  • HT201269 my 5s broke so i got a new one and the info isnt transfering the phone just shows the apple and a progress bar but the bar isnt moving what so ever

    phone wont progress from icloud transfer

    Hey there ddjild,
    It sounds like you are restoring your previous phones backup to your new one, but the progress bar appears to be stuck. According to this article:
    iOS: Apple logo with progress bar after updating or restoring from backup
    http://support.apple.com/kb/TS3681
    the process can take from several minutes to an hour to complete. The amount of time depends on the number of files on the device and whether you're erasing, updating, or upgrading your iOS.
    If the device has stil not finished the process, I would recommend resetting the device with the following article:
    Turn your iOS device off and on (restart) and reset
    http://support.apple.com/kb/ht1430
    To reset, press and hold both the Sleep/Wake and Home buttons for at least 10 seconds, until you see the Apple logo.
    If that does not get the phone booted back to the Lock Screen so you can get to your Home Screen, I would next try putting the device into recovery mode and attempting another restore from that backup:
    If you can't update or restore your iOS device
    http://support.apple.com/kb/ht1808
    Thank you for using Apple Support Communities.
    Cheers,
    Sterling

Maybe you are looking for