Copy link to clipboard
Copied
Hi guys,
I found a perfect Script for what i'm trying to achive written by @CarlosCanto but i'm wondering if because it was written in 2011 it's not working. I'm trying to split a lock of copy into individule text frames for each charachter while keeping each charachter in the same position. Please note i'm very new to scripts.
#target Illustrator
// script.name = splitSelectedWordsIntoCharacters.jsx;
// script.description = splits selected texFrames into separate characters;
// script.required = select point text textFrames before running;
// script.parent = CarlosCanto; // 4/13/11
// script.elegant = false;
var idoc = app.activeDocument;
var sel = idoc.selection; // get selection
var selCount = sel.length; // count items
var tWord = []; // to hold the textFrames
for (j=selCount ; j>0 ; j--) // loop thru selection & get textFrames backwards
{
tWord[j-1] = sel[j-1];
}
for (k = 0 ; k<tWord.length ; k++) // loop thru textFrames
{
var xpos = tWord.position[0]; // get x
var ypos = tWord.position[1]; // get y
var charCount = tWord.characters.length; // count characters
for (i=charCount-1 ; i>=0 ; i--) // loop thru characters backwards
{
var ichar = tWord.duplicate(); // duplicate textFrame
ichar.contents = tWord.characters.contents; // get last character
tWord.characters.remove(); // remove last character from original word
var width = tWord.width; // get the new width (without the last character)
ichar.position = [xpos+width,ypos]; // position the character = original position + new width
}
tWord.remove(); // remove textFrame (it is empty by now)
}
The script is designed for point type. You are probably using area type. Convert area type to point type and try again.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You copied an old version of the script. Carlos posted a new version on the forum in 2019. Check this
Copy link to clipboard
Copied
Thank you for that, It helps solve the error however I need the characters to stay in the same position. e.g. "WORD" turns into "W,O,R,D" the script linked layers every letter on top of each other.
Copy link to clipboard
Copied
Could you record an example or upload your file? I checked on CC 2019 and CC 2022, the script works without problems
Copy link to clipboard
Copied
Copy link to clipboard
Copied
The script is designed for point type. You are probably using area type. Convert area type to point type and try again.
Copy link to clipboard
Copied
Amazing thank you @femkeblanco and @Sergey Osokin !!!