InDesigns cancels processing on click

Jun 16, 2020

Copy link to clipboard

Copied

 

Hello,

 

I have an extension that has a process that takes a few minutes (exporting to a pdf).  

 

If the user clicks anywhere in InDesign while the export is running, InDesign just kills the process immidiatly.  This leaves the export files locked since it is not a gracious cancel and just leaves the user wondering what happened.

 

Is there any way to prevent this?  Force InDesign to wait until the process is done in the extension?

 

Than you!!

 

TOPICS
How to, Scripting

Views

250

Likes

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

InDesigns cancels processing on click

Jun 16, 2020

Copy link to clipboard

Copied

 

Hello,

 

I have an extension that has a process that takes a few minutes (exporting to a pdf).  

 

If the user clicks anywhere in InDesign while the export is running, InDesign just kills the process immidiatly.  This leaves the export files locked since it is not a gracious cancel and just leaves the user wondering what happened.

 

Is there any way to prevent this?  Force InDesign to wait until the process is done in the extension?

 

Than you!!

 

TOPICS
How to, Scripting

Views

251

Likes

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
Jun 16, 2020 0
Jun 16, 2020

Copy link to clipboard

Copied

"Doctor, my shoulder hurts when I raise my hand."

"Don't raise your hand!"

 

In other words, 'Don't touch your mouse while the script is running!'. But, seriously, you should ask the author of the extension about the problem.

P.

Likes

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
Reply
Loading...
Jun 16, 2020 0
Jun 16, 2020

Copy link to clipboard

Copied

Thank you Peter for your answer.

 

The thing is I wrote the extension and I did not put any code to do such a thing.  I am trying to figure out if I can prevent it somehow from happening.

 

I forgot to mention that this only happens in windows. The extension runs fine on a mac

J.

Likes

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
Reply
Loading...
Jun 16, 2020 0
Jun 17, 2020

Copy link to clipboard

Copied

Hi JG10,

you said: "…Force InDesign to wait until the process is done in the extension?"

Hm. I assume you do the export with ExtendScript method asynchronousExportFile().

You could try this with the older method exportFile() instead that will not use a background process.

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Reply
Loading...
Jun 17, 2020 0
Jul 01, 2020

Copy link to clipboard

Copied

Hi Uwe,

 

Thank you for your response.  Unfortunatelly, I can't do this asynchronusly since there is a process that runs after the export is completed.

 

Thank you, Jorge

Likes

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
Reply
Loading...
Jul 01, 2020 0
Adobe Employee ,
Jun 26, 2020

Copy link to clipboard

Copied

Hi there,

 

I am hoping that your issue has been resolved till now. If not, please feel free to update this thread else let us know if any of the suggestions shared above helped you or not.

 

Regards,

Sheena

Likes

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
Reply
Loading...
Jun 26, 2020 0
Jul 01, 2020

Copy link to clipboard

Copied

Hi Sheena,

 

I am still experiencing the problem. It only happens in windows.

 

Some PDFs take a few minutes to export, and if the user just clicks anywhere on InDesign it cancels the process.

 

Any ideas will be appreciated.

 

Jorge

Likes

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
Reply
Loading...
Jul 01, 2020 0
Jul 01, 2020

Copy link to clipboard

Copied

Hi Jorge,

so how exactly do you do this export?

What is the ExtendScript method you are using right now?

 

FWIW: My suggestion was to use method exportFile() over asynchronousExportFile().

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Reply
Loading...
Jul 01, 2020 0
Jul 01, 2020

Copy link to clipboard

Copied

Hi Uwe,

 

Oh, I misread.

 

...
var saveOpts = app.pdfExportPresets.itemByName(preset);
app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;
template.exportFile(ExportFormat.PDF_TYPE, pdfFile, false, saveOpts);
 
The blue line is the one that takes a while to process and where it breaks/stops if someone clicks anywhere inside InDesign.
 
Jorge
 
 
 

Likes

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
Reply
Loading...
Jul 01, 2020 0
Jul 01, 2020

Copy link to clipboard

Copied

Ok, Jorge,

I know of one case where the PDF export is affected with erratic clicks in the UI during exportFile():

If the document contains placed AI files, then it could happen that the graphics are missing in the exported PDF.

It never happened to me, that the whole export was canceled by that. That's new to me.

 

The only suggestion I can do now is to use asynchronousExportFile() instead where the user has full access to menus and tools with InDesign. You could check if the exported file is fully written by e.g. looking more or less constantly at its file size perhaps. Or you would run the whole thing with a ScriptUI that blocks the user from doing anything else, because you go with a modal interface. For example a "dialog" type of window.*

 

More details on scriptUI by Peter Kahrel here:

https://creativepro.com/files/kahrel/indesign/scriptui.html

 

* Sorry. Scratch this idea. If a modal dialog is open the script would do nothing until the user OKed or canceled the dialog.

 

Regards,
Uwe Laubender

( ACP )

 

Likes

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
Reply
Loading...
Jul 01, 2020 1
Jul 01, 2020

Copy link to clipboard

Copied

Hello,

 

RE: "You could check if the exported file is fully written by e.g. looking more or less constantly at its file size perhaps."

 

you can try this when exporting the pdf and before moving on in your code.

 

var saveOpts = app.pdfExportPresets.itemByName(preset);
app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;
task = template.asynchronousExportFile(ExportFormat.PDF_TYPE, pdfFile, false, saveOpts);
task.waitForTask();
 
Regards
Mike

Likes

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
Reply
Loading...
Jul 01, 2020 1