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

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

Enthusiast ,
Jun 28, 2020 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

Best
Mohammad Hasanin
TOPICS
Scripting

Views

452

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

correct answers 1 Correct answer

Community Expert , Jun 28, 2020 Jun 28, 2020

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

Votes

Translate

Translate
Community Expert ,
Jun 28, 2020 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

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
Enthusiast ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

LATEST

Thank you very much indeed

Best Regards

Mohammad

Best
Mohammad Hasanin

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