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.
Copy link to clipboard
Copied
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.