Progress bar
You will find a general example for the use of progress here.
Progress bar
static int start(
char* titel,
int steps = 24,
int useGlobal = 0,
int disableChild = 0)
Show the progress bar. When processing several scripts (Panel actions for several selected document frames) a progress bar will be opened and closed again at the end of the batch processing. In this case each script may use 24 steps. The progress will be automatically closed again at the end of the script.
The funktion is empty using comet_pdf.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
titel | String or char* | - | Window title. At the start the windows title and the caption will be used for the chapter. |
steps | int | 24 | number of steps. |
useGlobal | int | 0 | Should the progress bar be used globally across several scripts? 0 : No. The progress bar is automatically closed at the end of the script 1 : Yes, the progess bar must be closed within the executed scripts using progress::stop. The progress::unit function has not yet been adapted for the global progress bar and leads to errors when used in the global progress bar. |
disableChild | int | 0 | Set this to 1 to keep any subsequent progress bars from subdividing your progress bar. |
progress::start (title);
static int stop()
Close the progress bar. Scripts can only close the progress provided they themselves opened it.
The funktion is empty under comet_pdf.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode |
progress::stop ();
static int unit(char* chapter, int index = 0)
Change the chapter caption for the bar. If an index is defined, it will be attached to the chapter caption.
The progress::unit function has not yet been adapted for the global progress bar and leads to errors when used in the global progress bar.
The funktion is empty under comet_pdf.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
chapter | String oder char* | - | Chapter caption |
index | int | 0 | Chapter number |
progress::unit ("Chapter", 3);
static int step(char* label, int n = 1)
Call this before processing a task. Calling this will move the progress bar for any previously called tasks. The label is changed immediately.
Due to an InDesign® bug, the first call to the function does NOT change the label. Obviously Adobe repaints the window after progress bar changes only.
The funktion is empty under comet_pdf.
In the batch operation the maximum number of 24 steps for scripts must be observed.
Name | Type | Default | Description |
Return | int | 0 1 : In case of a global progress bar : Progress canceled |
|
label | String or char* | - | New sub-title under the bar |
n | int | 1 | Number of steps that the bar is to be repositioned forwards. 0 in the local progress bar : Only change the subtitle. 0 in the global progress bar : Only ask whether the progress has been cancelled. If so, the function returns the value 1. |
int one_step (int t) { int i; char task [256];
sprintf (task, "%d ...", t); progress::step(task, 1);
for (i=0; i < 1000000; i++) { }
return 0; }
int main () { int i; int m = 5;
progress::start ("It' a test", m);
for (i = 1; i <= m; i++) { one_step (i); }
progress::step ("Done", 0); progress::stop();
return 0; }
Alphabetic index HTML hierarchy of classes or Java