Highlighted

How to Make Progressbar to be Canceled when Cancel Script Execution?

Engaged ,
Jun 28, 2020

Copy link to clipboard

Copied

Dear Pros.

How to Make Progressbar Palette to be Canceled when the user hit Cancel Button to Stop Script Execution?

 Here is my Example of ProgressBar

//Creating ProgressBar
var myProgressPanel,
myMaximumValue = 300,
myProgressBarWidth = 300;
myCreateProgressPanel(myMaximumValue, myProgressBarWidth);

function myCreateProgressPanel(myMaximumValue, myProgressBarWidth) {
    myProgressPanel = new Window ('palette');
    myProgressPanel.text = "Exporting PDF Files";
    with (myProgressPanel) {
       myProgressPanel.myProgressBar = add("Progressbar", [12,12, myProgressBarWidth,24], 0,myMaximumValue);
       }
   return myProgressPanel;
    }
    myProgressPanel = myCreateProgressPanel (100, 400);
    myProgressPanel.show();
//End Creating ProgressBar  

 Thanks for any Help

Best Regards

Mohamamd

Adobe Community Professional
Correct answer by brianp311 | Adobe Community Professional

myProgressPanel.destroy()

 

When you call it depends on the control flow of your script. You could have an onClick event for your cancel button, or a returned result from show. You can also use myProgressPanel.close() to hide the progress panel while keeping it in memory. 

 

Highly recommend Peter Kahrel's ScriptUI book, available for free here: https://creativepro.com/files/kahrel/indesign/scriptui.html

Topics

Scripting

Views

96

Likes

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

How to Make Progressbar to be Canceled when Cancel Script Execution?

Engaged ,
Jun 28, 2020

Copy link to clipboard

Copied

Dear Pros.

How to Make Progressbar Palette to be Canceled when the user hit Cancel Button to Stop Script Execution?

 Here is my Example of ProgressBar

//Creating ProgressBar
var myProgressPanel,
myMaximumValue = 300,
myProgressBarWidth = 300;
myCreateProgressPanel(myMaximumValue, myProgressBarWidth);

function myCreateProgressPanel(myMaximumValue, myProgressBarWidth) {
    myProgressPanel = new Window ('palette');
    myProgressPanel.text = "Exporting PDF Files";
    with (myProgressPanel) {
       myProgressPanel.myProgressBar = add("Progressbar", [12,12, myProgressBarWidth,24], 0,myMaximumValue);
       }
   return myProgressPanel;
    }
    myProgressPanel = myCreateProgressPanel (100, 400);
    myProgressPanel.show();
//End Creating ProgressBar  

 Thanks for any Help

Best Regards

Mohamamd

Adobe Community Professional
Correct answer by brianp311 | Adobe Community Professional

myProgressPanel.destroy()

 

When you call it depends on the control flow of your script. You could have an onClick event for your cancel button, or a returned result from show. You can also use myProgressPanel.close() to hide the progress panel while keeping it in memory. 

 

Highly recommend Peter Kahrel's ScriptUI book, available for free here: https://creativepro.com/files/kahrel/indesign/scriptui.html

Topics

Scripting

Views

97

Likes

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
Jun 28, 2020 0
Adobe Community Professional ,
Jun 28, 2020

Copy link to clipboard

Copied

myProgressPanel.destroy()

 

When you call it depends on the control flow of your script. You could have an onClick event for your cancel button, or a returned result from show. You can also use myProgressPanel.close() to hide the progress panel while keeping it in memory. 

 

Highly recommend Peter Kahrel's ScriptUI book, available for free here: https://creativepro.com/files/kahrel/indesign/scriptui.html

Likes

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
Reply
Loading...
Jun 28, 2020 2
medos20 LATEST
Engaged ,
Jun 28, 2020

Copy link to clipboard

Copied

Thank you very much indeed

Best Regards

Mohammad

Likes

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
Reply
Loading...
Jun 28, 2020 0