Copy link to clipboard
Copied
Hi everyone,
Is there a way to select all of the text on all artboards and CREATE OUTLINES using Javascript? I've googled and googled, but I can't seem to find any help. The text that Adobe provides for scripting has this option for saving to FXGs which is preserveTextPolicy or something similar, but I need the same type of solution for saving as an AI file or as a command before the save. I'm currently working in windows, but am writing this script for use on a MAC. If there isn't an internal way of doing this through Javascript, does anyone know of another? I would imagine it would be possible through Applescript since it can access the application's GUI, but I'm not sure. A javascript solution would be preferable, but any solution would work at this point.
thanks,
Matt
The something like this may work… Should outline text at all depths wether it be locked or not visible… Sure it was posted here before… JS so you can try it on either platform…
...#target illustrator
function outlineDocText( ) {
if ( app.documents.length == 0 ) return;
var docRef = app.activeDocument;
recurseLayers( docRef.layers );
};
outlineDocText();
function recurseLayers( objArray ) {
for ( var i = 0; i < objArray.length; i++ ) {
// Record
Copy link to clipboard
Copied
There is a built-in command for this in all the scripting languages AI supports its a straight forward method of text.createOutlines()
Copy link to clipboard
Copied
Thanks for the response. Something straightforward is what I was looking for,but will that affect all text that even though it wasn't created with javascript like TextFrame.add or similar? And if so, could you provide a little sampling of this code if you have the time? That would be a huge help!
thanks
Copy link to clipboard
Copied
The something like this may work… Should outline text at all depths wether it be locked or not visible… Sure it was posted here before… JS so you can try it on either platform…
#target illustrator
function outlineDocText( ) {
if ( app.documents.length == 0 ) return;
var docRef = app.activeDocument;
recurseLayers( docRef.layers );
};
outlineDocText();
function recurseLayers( objArray ) {
for ( var i = 0; i < objArray.length; i++ ) {
// Record previous value with conditional change
var l = objArray.locked;
if ( l ) objArray.locked = false;
// Record previous value with conditional change
var v = objArray.visible;
if ( !v ) objArray.visible = true;
outlineText( objArray.textFrames );
// Recurse the contained layer collection
if ( objArray.layers.length > 0 ) {
recurseLayers( objArray.layers )
}
// Recurse the contained group collection
if ( objArray.groupItems.length > 0 ) {
recurseGroups( objArray.groupItems )
}
// Return to previous values
objArray.locked = l;
objArray.visible = v;
}
};
function recurseGroups( objArray ) {
for ( var i = 0; i < objArray.length; i++ ) {
// Record previous value with conditional change
var l = objArray.locked;
if ( l ) objArray.locked = false;
// Record previous value with conditional change
var h = objArray.hidden;
if ( h ) objArray.hidden = false;
outlineText( objArray.textFrames );
// Recurse the contained group collection
if ( objArray.groupItems.length > 0 ) {
recurseGroups( objArray.groupItems )
}
// Return to previous values
objArray.locked = l;
objArray.hidden = h;
}
};
function outlineText( objArray ) {
// Reverse this loop as it brakes the indexing
for ( var i = objArray.length-1; i >= 0; i-- ) {
// Record previous value with conditional change
var l = objArray.locked;
if ( l ) objArray.locked = false;
// Record previous value with conditional change
var h = objArray.hidden;
if ( h ) objArray.hidden = false;
var g = objArray.createOutline( );
// Return new group to previous Text Frame values
g.locked = l;
g.hidden = h;
}
};
Copy link to clipboard
Copied
You are the Jedi Master of Illustrator Scripting! thanks for this script. This will work and I just found another link where you helped someone else. You are truly amazing!! Thanks
Copy link to clipboard
Copied
Hum… I've seen muppets in space and I don't recall any of them having the force…
Copy link to clipboard
Copied
...well now one of them does. Thanks again for the help.
Copy link to clipboard
Copied
Hey Muppet Mark! I was hoping you could help me further this bit of scripting. I'd like to save a copy of the illustrator file and then create and save an outlined version, adding OUTLINE to the end of the file name. Is this doable? I'm just not sure where to add in the AIOptions and such... Could you help me?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now