• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

JS ScriptUI CS4: How to create an indeterminate progress bar?

Participant ,
Jan 23, 2010 Jan 23, 2010

Copy link to clipboard

Copied

Hi Folks,

Does anyone here know if ExtendScript (I'm using the CS4 flavor of ES) can produce an indeterminate (i.e., "barber pole") progress bar using ScriptUI's progressbar control? I've tried a number of value settings for the progress bar control in hopes that they would trigger the barber pole behavior, but so far, no luck.

My current workaround is to "loop" the progress indicator. In other words, when the progress bar's value > maxvalue, I reset the value back to minvalue. Then rinse and repeat. Not really what I want, but the task being processed takes quite a bit of time, so I need to show some sign of something happening to the user.

Thanks!

-- Jim

TOPICS
Scripting

Views

13.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Sep 09, 2012 Sep 09, 2012

Copy link to clipboard

Copied

nope.. not working for a progressbar.

yours is probably because you have no ScriptUI panel.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Oct 14, 2012 Oct 14, 2012

Copy link to clipboard

Copied

I'm close to a Mac+Win solution (CS4-CS6) that should render an indeterminate progress bar in pure ScriptUI.

My main problem was to make that component work even if the script is invoked from a menu. For some obscure reason, neither the enableRedraw condtion nor the win.update() method seem to allow the progress bar to get properly updated—on MacOS—when the script is triggered by a menuItem/menuAction couple.

However, I cannot pretend that trick will work on any machine. I'll give more details if its effectiveness is confirmed. Give it a try at:

http://www.indiscripts.com/blog/public/scripts/HurryCoverBeta.zip

(For a full test, run the script once from the Scripts panel, then click the Menu icon at the bottom of the dialog to have the script available in a menu. Then, re-run the script from Indiscripts > HurryCover BETA.)

Thank you for any feedback.

@+

Marc

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 06, 2012 Nov 06, 2012

Copy link to clipboard

Copied

hi marc!

any news in the indeterminate progress bar department?

ps. it seems to work in hurrycovers

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 15, 2013 Dec 15, 2013

Copy link to clipboard

Copied

Hello,

I dont know if this issue is solved yet..... but,

I created a script that does batch processing (to many files)

I wanted exactly what was asked for here - a progress bar that shows the progress of the exporting.

@ Vamitul

     I was so happy when I saw that code... until I realized that it was getting into an endless loop!!

     (Only later did I see that you wrote that yourself at the end of the post )

@ Jim

     Your script does work somewhat well, but there are 2 problems:

    1. It doesnt show you the progress of the export
    2. I never got the "completed" message, so seemingly it was alwyas breaking because of the 60 second interval - which is not so good because every exporting takes different amounts of time.

I spent a nice amount of time on this tonight... until I gave up!

Then I tried a little more... and I got it!!!

I think others can bebefit fromt his as well, so here it is

// First we run a loop througout the export process.

// Through watching the finder window during the export,

// I was able to see that the size if the file does get updated

// (and task complete) during the scripts hang-up

// Therefore we can know when to break out of the loop by that condition

while (File(newPDFFile).length < 1) {

     progressBar.value = myTask.percentDone;

}

// However, it is still not considered a completed task!

// If we just let the script continue at this point, we will get an error message.

// So, here we just wait till the task is officially completed and then we are done!

// This gives us the exact timing - no extra waiting!

while (myTask.status != TaskState.completed) {

     myTask.waitForTask();

}

or, in Vamitul script,

     replace these lines:

while (myTask.percentDone<100) {
     pBar.hit(myTask.percentDone)
}

     with these lines:

while (File(expFile).length < 1) {
     pBar.hit(myTask.percentDone)
}

while (myTask.status != TaskState.completed) {

     myTask.waitForTask();

}

I tested this in my script and it works great

I hope it will be of help to others as well!

ATB

Davey

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2013 Dec 16, 2013

Copy link to clipboard

Copied

@Davey – thank you for sharing this. The problem was pending. At least for me 😉

Now, I tested with a slightly altered version of the code from Vamitul (answer #23 here) – not exporting all InDesign files of a folder to PDF, but a selection of files from a folder – using your while loops instead the one by Vamitul.

I can only say:

it's working well.

Thank you!!

Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 17, 2013 Dec 17, 2013

Copy link to clipboard

Copied

Hi Uwe

Thanks for the confirmation!

I just realized that we dont really need to have the second part in a while loop

Technically it can be a stand alone code right outside the first loop:

while (File(newPDFFile).length < 1) {
     progressBar.value = myTask.percentDone;
}

   myTask.waitForTask();

and it will work the same way.

However, its probably better to put it in an if statement, just in case it is already complete:

while (File(newPDFFile).length < 1) {
     progressBar.value = myTask.percentDone;
}

if (myTask.status != TaskState.completed) {myTask.waitForTask()}

Davey

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2013 Dec 18, 2013

Copy link to clipboard

Copied

LATEST

@Davey – thank you again…

I'm not so sure, if "myTask" can be ever completed after the while loop.
So I think, the if statement will at least do no harm. 😉

Sorry, no time right before Christmas doing a lot of tests.

Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines