I created a script which will place text from rtf files from a folder to an active document on different page based on match. But if a font which was in doc file but not present in my mac, showed error while running the script.
That means Indesign opened a missing font alert box and script stop at that line and the error its shows "cannot handle the request because a modal dialog or alert is active".
Is is possible to suppress this error and script continue to place all RTF files? i have little knowledge on try/catch.
var myDoc = app.documents.item(0);
var sourceFolder = Folder("/Users/admin4/Desktop/ec_txt");
myFiles = sourceFolder.getFiles("*.rtf");
var myFrame1 = myDoc.pageItems.itemByID(111076); // switerland
var myFrame2 = myDoc.pageItems.itemByID(111114); // eurozone
var myFrame3 = myDoc.pageItems.itemByID(111146); // germany
for (var i=0; i < myFiles.length; i++)
switch (myFiles[i].name.slice (6, myFiles[i].name.lastIndexOf("_")))
myFrame1.parentStory.insertionPoints.item(-1).place(File (sourceFolder + "/" + myFiles[i].name))
myFrame2.parentStory.insertionPoints.item(-1).place(File (sourceFolder + "/" + myFiles[i].name))
myFrame3.parentStory.insertionPoints.item(-1).place(File (sourceFolder + "/" + myFiles[i].name))
To suppress the alerts you can use user interaction levels.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
Do not forgot to reset after the completion of the script with the following:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
Hope it solves your request.
Many Thanks. it worked......
its similar like Application.ScreenUpdating = False (in VBA for excel)
is it also possible to use "Preset" (RTF import options) which i made for importing RTF files?