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

InDesigns cancels processing on click

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

489

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
Community Expert ,
Jun 16, 2020 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.

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

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
Community Expert ,
Jun 17, 2020 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 )

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
Explorer ,
Jul 01, 2020 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

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
Adobe Employee ,
Jun 26, 2020 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

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
Explorer ,
Jul 01, 2020 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

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
Community Expert ,
Jul 01, 2020 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 )

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
Explorer ,
Jul 01, 2020 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
 
 
 

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
Community Expert ,
Jul 01, 2020 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 )

 

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
Advisor ,
Jul 01, 2020 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

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
Community Expert ,
Jul 01, 2020 Jul 01, 2020

Copy link to clipboard

Copied

My only advice might be to run a progress bar while the export is happening so the user knows not to click while it's happening. Show the progress bar before the export occurs and destroy it after the export is complete. Could include a note on the bar title to not touch anything while processing. Does the export successfully happen if no one touches it? 

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
Explorer ,
Jul 01, 2020 Jul 01, 2020

Copy link to clipboard

Copied

Yes, the export works well if no one touches it.

 

If someone touches it the next process gets an end of file exception.

 

Thank you!

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
Explorer ,
Jul 02, 2020 Jul 02, 2020

Copy link to clipboard

Copied

LATEST

One more comment on this,

 

I have something simmilar to a progress bar where the user can tell that something is processing.  However, since the process may take 5 or more minutes, the user sometimes moves to another program, and then when they go back to InDesign they inadvertently click on it and cancel the process.

 

I wonder if someone is able to replicate this issue.  I want to make sure is not just me having this problem.

 

Jorge

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