Copy link to clipboard
Copied
Dear all, hope you enjoying everyday.
I do "Unlonk All, Create Outlines, Embed" every time after finishing my artwork.
I use action for "Unlonk All, Create Outlines" and "Embed" by manually.
Some times I need to click more than 30 times just for embed...so I tried to avoid for meaningless click.
Finally I found Embed scrpit... as below.
---------------------------------------------------------------------------------------------------------------
#target Illustrator
if ( app.documents.length > 0 ) {
while ( app.activeDocument.placedItems.length > 0 ) {
placedArt = app.activeDocument.placedItems[0];
placedArt.embed();
}
}
---------------------------------------------------------------------------------------------------------------
but I can not record script on action.
After all this situation, I'm looking for the way to create script that include
"Unlonk All, Create Outlines All(Text only but with strock is better), Embed All".
Hopefully I can got help from here.
Thank you.
I can’t write scripts from scratch, if I am lucky I can modify or hack simple scripts together (I have a sort of Victor Frankenstein approach), however the following appears to mostly get the job done at a very basic level. Of course, there are lots of things it does not do, so results will vary depending on the complexity of your artwork and your specific requirements.
The text to outlines bit can always be improved upon, for example I don’t know how the following AppleScript code would be re-wr
...Copy link to clipboard
Copied
I can’t write scripts from scratch, if I am lucky I can modify or hack simple scripts together (I have a sort of Victor Frankenstein approach), however the following appears to mostly get the job done at a very basic level. Of course, there are lots of things it does not do, so results will vary depending on the complexity of your artwork and your specific requirements.
The text to outlines bit can always be improved upon, for example I don’t know how the following AppleScript code would be re-written in JavaScript.
#target Illustrator
// My first Illustrator Script - Something to look back on and laugh at when I know better!
//
// https://forums.adobe.com/message/10531441#10531441
// https://forums.adobe.com/message/10532624#10532624
//
// https://forums.adobe.com/message/10236331#10236331
// Unlock all layers & sublayers
processLayersRecursive(app.activeDocument.layers);
// Process all layers under variable "parent" (including sublayers on all levels).
function processLayersRecursive(parent){
for (var iLayer = 0; iLayer < parent.length; iLayer++){
var curLayer = parent[iLayer];
// Unlock the current layer
if (curLayer.locked){
curLayer.locked = false;
}
processLayersRecursive(curLayer.layers);
}
}
// Unlock all objects, select all & convert text to outlines
// https://ten5963.wordpress.com/illustrator-ccver-22-menu-commands-list/
app.executeMenuCommand('unlockAll');
app.executeMenuCommand('selectall');
app.executeMenuCommand('outline');
// https://forums.adobe.com/message/10531441#10531441
// Embed all linked images
if ( app.documents.length > 0 ) {
while ( app.activeDocument.placedItems.length > 0 ) {
placedArt = app.activeDocument.placedItems[0];
placedArt.embed();
}
}
// Deselect all
app.executeMenuCommand('deselectall');
Copy link to clipboard
Copied
Thank you so much. It works perfectly.
Just one more... if it's possible...
After this script, can we add one more step to open 'Save As...' window?
I tried add line like below but it's not working.
app.executeMenuCommand('saveas...');
or
app.executeMenuCommand('saveas');
But it's wonderful as is now. Thank you again
Copy link to clipboard
Copied
Happy to help and thank you for the feedback.
I am testing on a Mac using CS6 and CC2018 and adding the following code worked for me, I am not sure why you are having issues:
// Save as
app.executeMenuCommand('saveas');
Copy link to clipboard
Copied
Of note, all of the steps can be recorded into an action, except for the “embed images” step. The code provided in the original post can be saved and recorded into an action, then you have a hybrid approach (obviously having a script is better as there are no dependencies).

Copy link to clipboard
Copied
Thank you for everything. It's more than enough.
I really appreciate all your kindness.
Copy link to clipboard
Copied
Wow Stephen, you're freestyling now! Congratulations on your first script, you may have caught our disease and could be very well soon on your way to full-time pursuit!
Copy link to clipboard
Copied
Thanks for the encouragement Vasily!
I have made small modifications to a number of scripts, however I have only really “created” 3 scripts of my own where I have put in a lot of research and fumbling, standing on the shoulders of giants such as yourself.
Photoshop - Report Megapixel value of document
Acrobat - Report PDF Page Box Dimensions
Illustrator - The script above
Looks like my next foray should be InDesign to balance things out! Bridge can wait until I’m truly feeling masochistic.
As I am no longer active in production, it is only the random forum topic that may grab my attention and then I have an unfortunate tenacious streak that makes it hard to let go until things are just right.
Copy link to clipboard
Copied
Any chance you can explain how to get the embed function added to the action? I can't seem to get it working
Find more inspiration, events, and resources on the new Adobe Community
Explore Now