Copy link to clipboard
Copied
var doc = app.activeDocument;
var currentPage = doc.pages[0];
var textFrames = currentPage.textFrames;
var textFrame = textFrames[0];
var myOutlines = textFrame.createOutlines(false);
Here is a short script, made from a larger script I'm working on. When I run it, I get this dialog box:
Selecting "Yes" creates outlines as you'd expect, there's no actual problem here. Selecting "No" results in this error dialog box:
I believe I'm only getting this when trying to outline composite fonts. Putting the createOutlines() line inside a try/catch thing doesn't skip the first dialog box, but it does skip the second one (which means no outlines are created, which is not what I want).
How can I make the script automatically pick yes?
You can try setting the user-interaction level, which means that you bypass dialogs. You'll need a try/catch construct as well so that you can decide what to do with the error:
// Disable warnings
app.scriptPreferences.userInteractionLevel =
UserInteractionLevels.NEVER_INTERACT;
try {
var myOutlines = app.activeDocument.pages[0].textFrames[0].createOutlines(false);
} catch (e) {
// Do something to deal with the error
}
// Don't forget to reanable them
app.scriptPreferences.userInteracti
...
Copy link to clipboard
Copied
I am not a scripted. But I warn you, creating outlines in InDesign is a no-go as also objects will be missed.
Do outline in Acrobat Pro without any danger.
Copy link to clipboard
Copied
Hi @gregd, just echoing what @Willi Adelberger noted—are you sure that the outlining is working correctly (even after you click Yes, and testing on a good sample of composite glyphs)?
In terms of tackling the dialog—there is no Indesign-scripting-API way that I know of to click the button. You may be able to use a third-party utility, eg. AutoHotKey or KeyboardMaestro, but I do not have experience with those methods.
- Mark
Copy link to clipboard
Copied
You can try setting the user-interaction level, which means that you bypass dialogs. You'll need a try/catch construct as well so that you can decide what to do with the error:
// Disable warnings
app.scriptPreferences.userInteractionLevel =
UserInteractionLevels.NEVER_INTERACT;
try {
var myOutlines = app.activeDocument.pages[0].textFrames[0].createOutlines(false);
} catch (e) {
// Do something to deal with the error
}
// Don't forget to reanable them
app.scriptPreferences.userInteractionLevel =
UserInteractionLevels.INTERACT_WITH_ALL;
Copy link to clipboard
Copied
Thanks, this works even without the try/catch. InDesign seemingly just picks "Yes," presumably because it's the default option.
Copy link to clipboard
Copied
It's much safer to create outlines from Text - instead of TextFrame - at least bullets survive...
Copy link to clipboard
Copied
True, no doubt, but the OP asked how to avoid error messages.
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now