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!!
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.
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.
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 )
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
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
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
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 )
Copy link to clipboard
Copied
Hi Uwe,
Oh, I misread.
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 )
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.
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?
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!
Copy link to clipboard
Copied
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