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

cancelTask() & cancelAllTask()

Participant ,
Feb 03, 2016 Feb 03, 2016

Copy link to clipboard

Copied

I tried to stop a background exporting job using cancelTask() in my script. But i did not work, so did cancelAllTask().

please advise.Thanks

cheers.

TOPICS
Scripting

Views

333

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
Contributor ,
Feb 03, 2016 Feb 03, 2016

Copy link to clipboard

Copied

LATEST

Hi

in this snippet cancelTask() works for me.

var doc = app.documents[0];

var bg_tasks = app.backgroundTasks;

doc.asynchronousExportFile(ExportFormat.PDF_TYPE, new File("~/Desktop/w.pdf"));

doc.asynchronousExportFile(ExportFormat.PDF_TYPE, new File("~/Desktop/x.pdf"));

doc.asynchronousExportFile(ExportFormat.PDF_TYPE, new File("~/Desktop/y.pdf"));

doc.asynchronousExportFile(ExportFormat.PDF_TYPE, new File("~/Desktop/z.pdf"));

$.writeln(bg_tasks.length);

$.writeln(bg_tasks.everyItem().id);

$.writeln(bg_tasks.everyItem().name);

$.writeln(bg_tasks.everyItem().percentDone);

// cancel w.pdf and y.pdf export

bg_tasks[0].cancelTask();

bg_tasks[2].cancelTask();

// cancell all background tasks

// bg_tasks.everyItem().cancelTask();

thank you

mg.

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