Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

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

$
0
0

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 conditionwhile (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


Viewing all articles
Browse latest Browse all 37788

Trending Articles