Sunday, November 20, 2005
Open with No Warnings
In some workflows, the persistent "missing fonts" or "missing links" messages on opening an InDesign document are more annoying than helpful. So it occurred to me to write a script to address the issue. Obviously, to be useful, the script must be called in place of whatever technique is being used to open documents right now. That rules out double-clicking on the document's icon or using File/Open because the script can't insinuate itself into those processes. [Note to self: check out Rogue Sheep's plug-in; perhaps it can help in those cases.]
When this request came up on the Adobe User-to-User forum this morning, I banged out this script. I've written it to work with both CS and CS2:
The script also raises an issue (other than the idea to explore the Rogue Sheep plug-in): how does one filter an openDialog call so only InDesign documents are visible in the resulting dialog? When I have more time, I'll return to that issue.
When this request came up on the Adobe User-to-User forum this morning, I banged out this script. I've written it to work with both CS and CS2:
//DESCRIPTION: Open Doc with No WarningsThis script has one important lesson in it: if you're messing around with user preferences, make sure there's no way out of the script that leaves them in their "messed-around" state. That's why the error handling is pushed to the end of the script so that the interaction preference is reset before exiting.
if (app.version == 3) {
app.userInteractionLevel = UserInteractionLevels.neverInteract;
} else {
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
}
var myFile = File.openDialog("Choose InDesign document to open");
var myErr = "";
if (myFile != null) {
try {
app.open(myFile);
} catch (e) {
myErr = e;
}
}
if (app.version == 3) {
app.userInteractionLevel = UserInteractionLevels.interactWithAll;
} else {
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
}
if (myErr != "") {
alert(myErr);
}
The script also raises an issue (other than the idea to explore the Rogue Sheep plug-in): how does one filter an openDialog call so only InDesign documents are visible in the resulting dialog? When I have more time, I'll return to that issue.