Copy link to clipboard
Copied
I'm using a script (see also related question) to export all documents of a book to IDML:
- var contents = app.activeBook.contents;
- for(var i=0, content; i < contents.length; i++) {
- content = contents;
- var filename = content.fullName.fsName;
- var document = app.open(filename, showingWindow=false);
- var idmlname = filename.substr(0, filename.lastIndexOf(".")) + ".idml";
- document.exportFile(format=ExportFormat.INDESIGN_MARKUP, to=File(idmlname));
- document.close(saving=SaveOptions.NO);
- }
I'd like this process to be as unattended as possible, but unfortunately sometimes a cross-reference is outdated and I'm asked to update it there might also be other user-interaction interruptions I haven't yet encountered but would also like to cover).
Is there any way to open a document in a "yeah, just open it the way it is without asking the user"?
But before you exit, make sure to set it back!
try{
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
}
catch(_){}
finally{
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL);
}
Ariel
Copy link to clipboard
Copied
use the below line in first of your code..
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
Copy link to clipboard
Copied
But before you exit, make sure to set it back!
try{
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
}
catch(_){}
finally{
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL);
}
Ariel