Copy link to clipboard
Copied
Hi,
I am trying to export Indesign document into PDF using Javascript. When the document has a missing font or link, a warning pops up and the export command fails saying there is a modal dialog that is open. How do I disable all the warnings or close all the warning dialogs before executing my export command?
thanks for your help.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
This will completely and utterly hide all dialogs. Be kind to your users (and to yourself!) and disable it just before a command that may pop up unwanted dialogs; then, right after that command, enable them again! Or else you will never see a Javascript error pop up, or, for that matter, any other ID dialog. It does what it says on the label!
Copy link to clipboard
Copied
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
This will completely and utterly hide all dialogs. Be kind to your users (and to yourself!) and disable it just before a command that may pop up unwanted dialogs; then, right after that command, enable them again! Or else you will never see a Javascript error pop up, or, for that matter, any other ID dialog. It does what it says on the label!
Copy link to clipboard
Copied
Hi Rums,
I have an Applescript to do a PDF export with warnings for missing/modified links or fonts that works nicely from the script panel in InDesign.
But I wanted to make it run form a panel. Unfortunatly teh Adobe Configurator only works with javascript.
I have no expertise at all with javascript.
Could I make use of your script?
Would be very grateful.
Copy link to clipboard
Copied
sure kris..... here is the script that I used.
var runScript = function (inputFilePath, pdfFilePath)
{
try {
// suppress warnings, alerts
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
// open input file
var inFile = new File (inputFilePath);
var myDocument = app.open (inFile);
// export the file to pdf
app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;
var pdfFile = new File(pdfFilePath);
myDocument.exportFile(ExportFormat.pdfType, pdfFile, false);
// Close the document in InDesign
app.activeDocument.close(SaveOptions.no);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
} catch (e) {
alert ("There was a problem exporting file ("+e+")");
}
}
Copy link to clipboard
Copied
var myFolder = Folder.selectDialog("Select an in folder.");
var files = myFolder.getFiles ("*.indd");
var outFolder = Folder.selectDialog("Select an out folder.");
app.scriptPreferences.userInteractionLevel=UserInteractionLevels.NEVER_INTERACT;
for(i = 0, l = files.length; i <l; i++)
{
myFile = app.open(files, true)
}
myFile.exportFile(ExportFormat.PDF_TYPE, File(outFolder + "/" + myFile.name.replace(/\.indd$/,"") +".pdf"), false);
myFile.close(SaveOptions.NO);
}
alert("PDFs have been generated.")
app.scriptPreferences.userInteractionLevel=UserInteractionLevels.interactWithAll
Find more inspiration, events, and resources on the new Adobe Community
Explore Now