comet.progress¶
The comet.progress module provides functions showing a progress bar during script execution.
Methods¶
- comet.progress.start(title: str = 'Progress', steps: int = 24) None ¶
Show the progress bar.
When processing multiple scripts (panel actions for multiple selected document frames), a progress bar is automatically opened and closed at the end of batch processing.
The progress bar is automatically closed at the end of the script.
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
- Available:
InDesign®
- CScript:
- comet.progress.step(count: int = 1, label: str = '') None ¶
Increment the progress bar and optionally set a hint text.
The hint text is shown below the progress bar.
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
ValueError – When parameter count is negative.
- Available:
InDesign®
- CScript:
- comet.progress.stop() None ¶
Stop and hide the progress bar.
- Return type:
None
- Available:
InDesign®
- CScript:
Examples¶
Close all open documents and show the progress.¶
#!py
#pragma plain
import comet
def main():
documents = comet.document.getOpen()
documentCount = len(documents)
#Open the progress bar
comet.progress.start('Closing all documents', documentCount)
#Close all documents - this can take a while depending on the number and size of documents
for document in documents:
document.close()
#Increment the progress bar and set a new sublabel
comet.progress.step(label = f'Closed document {document.getName()}')
#Everything finished - close the progress bar
comet.progress.stop()
return 0