[JS] CS3 ScriptUI - progress bar

Hello

I know I'm late to the game with ScriptUI in CS3, but I would use a progress bar with some of my scripts any longer.

I read through the relevant part of the guide to script, but can't seem to get things to work, the guide seems to refer to a script that is not in the file.

Can anyone offer some simple tips on what to do, or point me in the direction of a script that uses this feature that I can pull out and use?

Thanks in advance,

Roy Marshall

Roy, download the SDK from Adobe Bridge CS3 and watch SnpCreateProgressBar.jsx example. This should help.

Here's a quick example will create a doc Virgin 100pg:

indesign #target
#targetengine "session".
var myDialog = new window ("palette", "ProgressBar");
myDialog.btn = myDialog.add ('button', undefined, "that there is a progress bar.");

var myProgressPanel;
var myMaximumValue = 100;
var myProgressBarWidth = 300;
var myIncrement = myMaximumValue/myProgressBarWidth;

myProgressPanel = new window ('window', 'Progress');
{with (myProgressPanel)}
myProgressPanel.myProgressBar = Add ("progressbar", [12, 12, myProgressBarWidth, 24], 0, myMaximumValue);
}

myDialog.btn.onClick = function () {}
myDocument var = app.documents.add ();
myDialog.close ();
addlotsofpages();
   
   
}

function addlotsofpages() {}
   
myProgressPanel.show ();
       
for (var myCounter = 0; myCounter< 99;="" mycounter="">
   
myProgressPanel.myProgressBar.value = myCounter/myIncrement;
App.Documents.Item (0) .pages. Add();
if(MyCounter == 100) {}
myProgressPanel.myProgressBar.value = 0;
myProgressPanel.hide ();
}
}
myProgressPanel.close ();
Alert ('Done');
   
}

myDialog.show ();

Post edited by: John Kordas

Tags: InDesign

Similar Questions

  • CS3 JS progress bar function

    I am trying to create a progress bar function, but the code below creates 6 instances of the progress window rather than the update info in the first window.  I went for the loop process making progress work bars is the only way that it can be used or is it possible to tell if a window is open on if so update the bar and the news of this window?

    to call to the stand, I use stagesLeft ("search duplicates", 1)

    
    
    

    function stagesLeft(myText,stageVal){
       
        var myStop =6;
        var myPbValue = stageVal;
        var myWindow = new Window ( 'window',' Progress');
        var myProgressBar = myWindow.add ('progressbar', [12, 12, 350, 24], 0, myStop);
        var myStaticText = myWindow.add('statictext');
        myStaticText.bounds = [0, 0, 340, 20];
        myStaticText.alignment = "left";
       
            myWindow.show();
            myProgressBar.value = myPbValue;
            myStaticText.text = myText;
            myWindow.text = 'Stage '+ myPbValue + ' out of ' + myStop;

     

           
            if(myPbValue == 6){
            myWindow.close();
                }
        }

    ScriptUI needs time to get used to :-) A 'simple' progress bar was also my first try and I think that I made similar mistakes. But nothing to worry about.

    The reason why you get more than a window, of course, is that this line in your service:

    myWindow = new window...

    (and later myWindow.show ();)

    You must create the window (and in most cases, immediately Show it) somewhere at the beginning of your script in an initialization phase. Who will pop to the top of the window in the State you created. Check the variable containing the window a global, so you can access them even when you use functions to 'drive '.

    In your update loop, you only need to change the elements: myProgressBar.value, myStaticText.text and myWindow.text. ScriptUI is smart enough to check if items are on the screen and change them immediately.

    Only when you have finished processing, you call myWindow.close ().

  • Help with progress bar.

    Hi, I tried to add a few different progress bars to this script and I get errors.  Can someone please?   I at the moment at the beginning of the Script, but I got it at the end as well with no luck.  Here's the Code.

       #targetengine "AutoStartScript" 
       
    // Save and open information      
        app.addEventListener( "beforeSave" , doTextFrameOnPageOne );  
        app.addEventListener( "beforeSave" , doZeroPoint );
        app.addEventListener( "afterOpen" , doZeroPoint );
    
    // -----------------> Progress Bar<-------------------    
        app.scriptPreferences.enableRedraw = true
        var found = Array(50);
        var w = new Window('palette');
            w.add ("progressbar", undefined, start, stop);
            w.pbar = w.add('progressbar', undefined, 0, found.length);
            w.pbar.preferredSize.width = 300;
            w.show();
        for(var i = found.length-1;i>-1;i--){
            w.pbar.value = found.length-i;
            $.sleep(20);
            }
        
     // Reset the Zero Point on documents.   
        function doZeroPoint()
            {
               app.documents[0].zeroPoint = [0,0]; 
            
          
    // Create New Layer      
        function addLayer(doc, name) {  
        try{  
                var layer = doc.layers.itemByName(name);  
                if(layer && layer.isValid) {  
                         return layer;  
                    } else {  
                var myLayer = doc.layers.add();  
                myLayer.name = name; 
                
                    return myLayer;  
            }  
          } catch(e) {  
         }  
        }  
          
    // Create Text Frame      
        function addTextFrame(doc, layer, name) {  
            var myBlendingSettings = { blendMode : BlendMode.OVERLAY };        
            var myTransparencySettings = { blendingSettings : myBlendingSettings };     
              
            var tf = doc.textFrames.itemByName(name);  
            if(tf && tf.isValid) {        
                tf.remove();  
            }  
            tf = doc.textFrames.add(layer, LocationOptions.UNKNOWN, {name: name, fillColor :"Yellow", fillTint: 20, transparencySettings : myTransparencySettings, geometricBounds: ['0in','-5.45in','1.45in','-.75in'] });        
                  return tf;  
        }  
          
    // Create Table      
        function addTable(tf) {  
            var myTable = tf.texts[0].tables.add        
                (        
                   {         
                     // Number of Rows and Columns.      
                      bodyRowCount : 6 ,         
                      columnCount : 2         
                              
                 }        
            );       
          
        return myTable;  
            }  
          
          
        function addVariable(doc, name, value) {  
            var v = doc.textVariables.itemByName(name);  
            if(v && v.isValid)  
                return;  
          
            v = doc.textVariables.add({name:name, variableType:VariableTypes.CUSTOM_TEXT_TYPE});  
            v.variableOptions.contents =  value;      
        }  
          
          
        function doTextFrameOnPageOne(event)        
         {       
            var doc = event.target;     
            if(!(doc && doc.constructor.name == "Document")) {  
                return;  
            }  
                
    // Create New Layer   
            var myLayer = addLayer(doc, "SaveInfo");  
               
            var columnOneContentsArray = [                  
                 
                 "Document:" ,        
                 "User Name:",       
                 "Computer Name:",      
                 "Date Modified:",            
                 "Date Output:",      
                 "Date Created:",      
                 "Output Date:"        
            ];        
                    
            var columnTwoContentsArray = [     
                ];     
                       
            var tf = addTextFrame(doc, myLayer, "SaveInfo");  
    // Table Properties
            var myTable = addTable(tf);  
                setColumnWidthsAndAlignments(myTable)  
        function setColumnWidthsAndAlignments(tableObj)  
           {  
            var myWidths=[1.35, 3.32];  
            var myAlignments=[Justification.LEFT_ALIGN,Justification.LEFT_ALIGN];  
            var numberOfColumns=tableObj.columns.count();  
            for (c=0;c<numberOfColumns;c++)  
           {  
                myTable.columns[c].width=myWidths[c];  
                myTable.columns[c].cells.everyItem().texts.everyItem().justification=myAlignments[c];  
           }  
          }       
    // Create New Text Variables and Variable Options.
            var md = doc.textVariables.itemByName("Output Date");
                md.variableOptions.format = "MMMM dd, yyyy hh:mm a";
            var md = doc.textVariables.itemByName("Creation Date");
                md.variableOptions.format = "MMMM dd, yyyy hh:mm a";
                tv = doc.textVariables.item("Users Name");    
                !tv.isValid && tv = doc.textVariables.add({name:"Users Name", variableType:VariableTypes.CUSTOM_TEXT_TYPE});            
                tv.variableOptions.contents =  String( getAppUserName() );  
                tvL = doc.textVariables.item("CLN");   
                !tvL.isValid && tvL = doc.textVariables.add({name:"CLN", variableType:VariableTypes.CUSTOM_TEXT_TYPE});    
                tvL.variableOptions.contents =  String( getLogInUserName() ); 
              
                       
    // Placing Text variable information in tables             
            var R1, R2, R3, R4, R5, R6;       
                     
                myTable.columns[0].contents = columnOneContentsArray;        
                myTable.columns[1].contents = columnTwoContentsArray;        
            var cell0OfColumn2insertionPoint1 = myTable.columns[1].cells[0].insertionPoints[0];       
            var R1 = cell0OfColumn2insertionPoint1.textVariableInstances.add(LocationOptions.AFTER, cell0OfColumn2insertionPoint1);            
                R1.associatedTextVariable = doc.textVariables.itemByName("File Name");       
            var cell1OfColumn2insertionPoint1 = myTable.columns[1].cells[1].insertionPoints[0];      
            var R2 = cell1OfColumn2insertionPoint1.textVariableInstances.add(LocationOptions.AFTER, cell1OfColumn2insertionPoint1);    
                R2.associatedTextVariable = doc.textVariables.itemByName("Users Name")         
            var cell2OfColumn2insertionPoint1 = myTable.columns[1].cells[2].insertionPoints[0];          
            var R3 = cell2OfColumn2insertionPoint1.textVariableInstances.add(LocationOptions.AFTER, cell2OfColumn2insertionPoint1);            
                R3.associatedTextVariable = doc.textVariables.itemByName("CLN");         
            var cell3OfColumn2insertionPoint1 = myTable.columns[1].cells[3].insertionPoints[0];        
            var R4 = cell3OfColumn2insertionPoint1.textVariableInstances.add(LocationOptions.AFTER, cell3OfColumn2insertionPoint1);            
                R4.associatedTextVariable = doc.textVariables.itemByName("Modification Date");       
            var cell4OfColumn2insertionPoint1 = myTable.columns[1].cells[4].insertionPoints[0];       
            var R5 = cell4OfColumn2insertionPoint1.textVariableInstances.add(LocationOptions.AFTER, cell4OfColumn2insertionPoint1);            
                R5.associatedTextVariable = doc.textVariables.itemByName("Output Date");       
            var cell5OfColumn2insertionPoint1 = myTable.columns[1].cells[5].insertionPoints[0];      
            var R6 = cell5OfColumn2insertionPoint1.textVariableInstances.add(LocationOptions.AFTER, cell5OfColumn2insertionPoint1);            
                R6.associatedTextVariable = doc.textVariables.itemByName("Creation Date");         
            }        
          
          
    //  Computer User Name          
            function getLogInUserName()        
         {        
              
             var userNameOSX = $.getenv("USER");        
             var userNameWindows = $.getenv("USERNAME");        
                    
                if(userNameWindows == null){return userNameOSX}        
                else{return userNameWindows};        
                    
            }        
    // Application Name           
            function getAppUserName() 
            {        
                return app.userName;        
        }
    

    Thanks for any help you can give.  I had the 'progress bar' above ScriptUI for Dummies, I believe that sound of Peter.

    Have you tried to add a statement of w.update () after each time that the progress bar is incremented? (See the bug progress bar.) (Summary of the situation) )

    Ariel

  • How to add a progress bar in a function that is called recursively

    How to add a progress bar in a function that is called recursively

    Hello

    You can use ScriptUI to create progressbar in your script. Here is an example on how the progress bar can be created:

    var progressRes = "dialogue."

    {\

    text: "Auto Collection,"------

    preferredSize: [450, -1],

    View1: Group\

    {\

    alignment: 'fill', orientation: 'column ', \

    _label: StaticText {alignment: 'left', text: 'reviewing the images...} »}, \

    _Progress: Progressbar {alignment: 'fill', properties: {name: 'progress'}}, \

    _startAndCancel: button {text: 'Start',------}

    started: false, cancelled: false,

    Properties: {name: 'Cancel'} \

    },\

    }\

    }";

    var progressWindow is new window (progressRes);.

    progressWindow.progressBar = progressWindow.findElement ("course").

    progressWindow.cancelButton = progressWindow.findElement ('Cancel');

    progressWindow.cancelButton.onClick = function()

    {

    If (this.started)

    This.Cancelled = true;

    else {}

    This.Started = true;

    This.Text = "Cancel";

    this.window.startWork ();

    }

    }

    Start the 'work' when you click the Start button

    progressWindow.startWork = function()

    {

    While (this.progressBar.value< this.progressbar.maxvalue="">

    ! this.cancelButton.cancelled)

    {

    this.progressBar.value = this.progressBar.value + 1;

    This.Update();

    this.workFunction ();

    }

    progressWindow.close (this.cancelButton.cancelled? 1: 2);

    }

    progressWindow.workFunction = function()

    {

    $.sleep (500);

    }

    progressWindow.setMax = function (maxval)

    {

    progressWindow.progressBar.maxvalue = maxval;

    progressWindow.progressBar.value = 0;

    }

    progressWindow.setText = function (label)

    {

    progressWindow.children [0] ['_label'] .text = label;

    }

    -test code

    function progressTest()

    {

    progressWindow.setMax (8);

    var result = progressWindow.show ();

    Do something with result...

    }

    progressTest();

    Thank you

    -Anshul

  • Progress bar get about 60% and stuck

    Hello

    I had difficulties with the last update of El Capitan - my imac will not re-start and could get stuck on the spinning wheel. I could turn it off with the power switch and turn it back on w/out the update and it works great except for chrome.

    Today I was asked to restart the update and I thought I'd give it a try. This time, he stops normally and looked like it will re-start! While she has been reset the progress bar froze on the gray apple screen and then the screen started to Flash. If anyone has any suggestions on how to fix this would be appreciated. Thanks in advance!

    Use the Combo Update 10.11.6:

    Apple - Support - downloads

    The Combo update is a complete installation, as opposed to an incremental "delta" update, so you have to overwrite all files are damaged or missing. It does not matter if you have previously applied. All your data and settings must be kept, but that said, you should always have a backup.

  • Where the dialogue progress bar copy

    Hello

    I tried to copy something big (about 6 GB) from one folder to another folder to an external HARD drive. How is he had no copy automatically appeared in the Yosemite progress bar to display the status of the copy.

    How can I get the dcopy progress bar dialog to appear (as he did in Yosemite)?

    Thank you

    Not sure I understand the question. If you move a file from one folder to another folder on the same drive, there is no need of a progress bar. It would be just to change the path of the file.

  • When I use the mail merge with excel file, after I press ok the progress bar indicates "NaN", mail project window crashes. My record is nice little CVS n

    When I use the mail merge with excel file, after I press ok of the progress bar indicates "NaN", mail project window crashes. My file is in the correct format and small size (4-column 4 raws). I use an English version of thunderbird after accidentally, I installed one in my tongue.

    I am attaching the screenshot

    I solved the problem
    has been st@pid excel

    I created a CSV file in openoffice calculator and everything went smoothly

  • With the help of the CocoDialog in AppleScript progress bar

    Script editor 2.7 (176)

    2.4 AppleScript

    I'm trying to use CocoaDialog with AppleScript to view and update a progress bar. However, I can't know exactly how to invoke a progress in AppleScript bar. I could not even open a window for future progress bar, and still less of the update.

    Please could someone advise me as to what AppleScript code should I put in the simple loop example below to create a progress bar CocoaDialog and running.

    Thank you very much

    Andrew.

    ----------------------------------------------------------

    cocoaDialogFilePath the value "/ Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog".

    the value of myText to form quotes "is a progress bar.

    -Bar settings first progress

    shell script cocoaDialogFilePath & "progressbar - text" & myText & "‑‑percent" & 0 & '‑‑float' & '‑‑stoppable '.

    -Create a loop and update the progress bar

    Repeat with 1 to 5 myCounter

    < What code put here for display and update the bar using the value of the progression CocoaDialog myCounter? >

    delay 1

    end repeat

    ----------------------------------------------------------

    There is an short and progress bar example here macosautomation. Or an example of an AppleScript/CocoaDialog Progress bar here. The native OS X 10.10 or later AppleScript approach to a progress bar displayed in the Script Editor status bar and a progression for applications and compiled scripts dialog box.

  • There was formerly a progress bar for when the e-mails were being downloaded. It has now disappeared. What happened to him?

    My e-mail provider does not always play nice. There has always been a progress bar in the status bar to indicate that the emails were download correctly. If I don't see the progress bar, I knew to check with the provider. Recently, the progress bar went, and I have no way of knowing whether or not the emails are downloading. They appear any kind of surprise. In addition, I used to send a message that there is no new messages availalble to download (if there is no message to download) on the status bar even. He went as well. I have so no way of knowing if I get no messages because there is no, or if I don't receive messages because the provider did something. So my question is: is this an error with Thunderbird or was there an update which resulted in a loss of function that I relied on? If it's an error, what should I do about it?

    Good to know. It has been long since this problem was asked about. I thought Ad Blocker had fixed their add on.

    You mark this as resolved if it is satisfied? Thanks for the update of the question in order to help the next user of Thunderbird.

  • When the connection progress bar

    I have a MacBook 11 "(mi-2013) I've upgraded to El Captain 10.11.5"
    Since the upgrade, I see a bar when I enter my password when connecting to progress.
    Before the upgrade, there was a progress bar when I switched to Mac.

    Why is there a progress bar now? I was under the impression that Mac is not that!

    PS. I'm new to Mac.

    Hi itAftab,

    It's not bad! Happens to me as well on my Macbook Air. Don't worry - it's just a way for you to see the progress of starting.

  • Download mail and progress bar does not.

    New installation Win 8.1 and tuberculosis 24.5.0 with IMAP email server and there are no Add-ons installed. No solution on the web searches or forum.

    So far, the issue was seen in Win 7, where the progress bar has been distorted on a classic theme but not an Aero theme. In Win 8, the default themes are similar to the Win 7 classic themes, and there is no default Aero themes.

    However, TB works very well by about 8.1 win a classic or a custom theme. If, as a test, you need to install (just) a theme customized Windows site, I wonder if you would see any difference with TB.

  • How can I remove the message "sending progress bar?

    When I send an e-mail, sometimes with a send notification with a scrolling box progress bar. How to disable this option?

    Tools(or AppMenu/options)/Options/Advanced/general/Config. Editor, copy mailnews.sendInBackground into the search box, double-click to change for real.

    http://KB.mozillazine.org/Thunderbird_3.0_-_New_Features_and_Changes#Send_in_Background

  • iPad 2 Mini stuck on the progress bar with the Apple logo and progress bar is not loaded, his impasse

    I pressed on restart all the settings on my iPad Mini 2, so it loaded but it drained. So I rebooted it until he turned back when he turned his back, it was still showing the progress bar, but it was quite moving. I tried to hold down the lock button and the home button, but still, it loads, its stuck on the progress bar and did not progress. I tried to connect to my computer to connect to itunes, but it does Duke host because its deadlock on the progress bar with the apple logo.  .pls help me!

    Try restoring your backup and recovery mode: If you cannot update or restore your iPhone, iPad, or iPod touch - Apple Support

  • YouTube progress bar keeps flashing

    I don't think it's a problem of FF because it also happens when I use IE 10, but I always get better help than Youtube or IE.

    When I watch a video on Youtube the guard progress bar appearing and disappearing every few seconds if you move the mouse. I tried to move the mouse in an area off the screen and turn it off (the mouse, it's a Microsoft 3500 wireless) but that made no difference, it just guard appearing and disappearing every few seconds.

    It does exactly the same thing if I use IE10, so I don't think it's an add-on to FF or app. I never use IE10 so I don't have a bunch of applications loaded on it.

    Other sites video don't do this then I think it's a problem of Yotube. He just started to arrive two days ago. Does anyone else have this problem? Or a solution?

    Well I don't know if it will work or not. When I'm went on Youtube to try your suggestion the problem had resolved itself!

    Your good suggestion sounds and quick response is appreciated so I'll mark your message as useful/solved.

    Firefox rules! I always get excellent help.

  • How will I know if El Capitan is the download?  Should there be a progress bar?

    I'm trying to upgrade to El Capitan of Mavericks on an iMac 2011.  In the app store, I clicked on 'get', and he said now "Download" in the same space a little more than half an hour.  Is there a progress bar or something similar to let me know what happens?  What IS happening?  Don't know what to look for and I see other posts where people speak of it takes a lot of time, but there is nothing tell me at any % is done.

    Thank you

    (If this is posted in the wrong place, please let me know and I'll move it.)

    Hello.

    You are in the right place!

    You should be able to see the status by clicking the launch pad iconof your Dock.

    On a connection high speed, it can last from an hour to an hour and a half. Your iMac itself may restart several times during the download and installation process. It's normal. Apple just do the work for you.

Maybe you are looking for

  • El Capitan Server - Mail does not

    Today I installed the latest security update on my server of El Capitan (10.11.6) running 5.1.7 Server- Unfortunately! After that, the e-mail server does not answer more. I find a lot of messages in the log files: ... the kernel [0]: sandbox: clamd (

  • Re: Satellite L755d - all browsers except IE8 crashes after a few minutes

    Hello I have a Toshiba l755d for a month. Everything works well except firefox, chrome and opera.IE8 works. At first I thought it was just firefox because I just test firefox. SO I wrote a thread in my own language for firefox forum. Nobody has been

  • consumption of RAM mounts even without open tabs

    Every time when I'm hibernating computer I close all applications, including firefox, so I noticed that from time to time it consumes mor to 1, 5 GB of ram doing nothing only 2 tabs are open both without flash games or whatever it is, even if there i

  • Date on Photo display

    The date appears on the images. It doesn't seem to be a way to turn it off. Anyonce have a suggestion?

  • Monitor display problems

    Hello I was using my laptop (Dell Inspiron 1720), and somehow I pressed a few buttons that transformed my horizontal office on the screen. How can I fix it. Mozartman