Copy link to clipboard
Copied
As mentioned above, i have a huge document with multiple overset (and unwanted) text all around, i want to clean it up and dont want to go one by one.... maybe a script? Thank you !!
Okay @Lalo Mc. Fly, after accidentally writing the script for Indesign (*facepalm*) here is my attempt at the same script for Illustrator. Let me know if any bugs, and ideally post a sample document that shows the bug.
- Mark
/**
* Remove All Overset Text In Active Document For Illustrator
* @author m1b
* @discussion https://community.adobe.com/t5/illustrator-discussions/is-there-a-way-to-delete-all-my-overset-text-at-once/m-p/13832918
*/
(function () {
var doc = app.activeDocument,
...
Copy link to clipboard
Copied
EDIT: Sorry! On my phone I couldn't see which forum this was posted in and I assumed it was Indesign. Please ignore this answer because it is a script for Indesign.
Hi @Lalo Mc. Fly, here's a script that should do this. I just wrote it now, so it's quite untested, so have a careful look through your document after using it.
- Mark
/**
* Remove All Overset Text In Active Document for Indesign
* @author m1b
* @discussion https://community.adobe.com/t5/illustrator-discussions/is-there-a-way-to-delete-all-my-overset-text-at-once/m-p/13832918
*/
function main() {
var doc = app.activeDocument,
stories = doc.stories.everyItem().getElements(),
counter = 0;
for (var i = stories.length - 1; i >= 0; i--) {
if (stories[i].overflows == false)
continue;
var lastTextFrame = stories[i].textContainers[stories[i].textContainers.length - 1];
var overFlowText = stories[i].characters.itemByRange(lastTextFrame.texts[0].insertionPoints[-1], stories[i].insertionPoints[-1]);
if (overFlowText.isValid) {
overFlowText.remove();
counter++;
}
}
alert('Removed ' + counter + ' overset texts.');
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Remove All Overset Text');
Copy link to clipboard
Copied
Hi Mark, is that script for InDesign?
Copy link to clipboard
Copied
Oops! Haha. Yep, on my phone I didn't notice it was for Illustrator!
Copy link to clipboard
Copied
Okay @Lalo Mc. Fly, after accidentally writing the script for Indesign (*facepalm*) here is my attempt at the same script for Illustrator. Let me know if any bugs, and ideally post a sample document that shows the bug.
- Mark
/**
* Remove All Overset Text In Active Document For Illustrator
* @author m1b
* @discussion https://community.adobe.com/t5/illustrator-discussions/is-there-a-way-to-delete-all-my-overset-text-at-once/m-p/13832918
*/
(function () {
var doc = app.activeDocument,
stories = doc.stories,
counter = 0;
for (var i = stories.length - 1; i >= 0; i--) {
var story = stories[i],
lastTextFrame = story.textFrames[story.textFrames.length - 1];
// point text can't be overset
if (lastTextFrame.kind == TextType.POINTTEXT)
continue;
// make a temp frame to take the overset text, if any
var temp = doc.textFrames.areaText(doc.pathItems.rectangle(0, 0, 3000, 3000));
lastTextFrame.nextFrame = temp;
var over = temp.characters;
// remove the overset text
if (over.length && counter++)
for (var j = 0; j < over.length; j++)
story.characters[story.characters.length - 1].remove();
// clean up
temp.remove();
}
alert('Removed ' + counter + ' overset texts.');
})();
Copy link to clipboard
Copied
Script works perfectly, thank you so much Mark !
Copy link to clipboard
Copied
You're welcome!
Copy link to clipboard
Copied
It may also work by selecting all (area) type objects, converting them to point type objects in the Type menu (a warning message should appear then, informing that you are going to clear all overset text with that step) and then converting the point type objects back to area type objects.
Copy link to clipboard
Copied
Cool approach Kurt! that would be super quick and convenient in most cases but if you have overset text on a path you may need my script.
- Mark
Copy link to clipboard
Copied
But, Kurt, that introduces soft returns at every line, so you also need some find/replace.
Copy link to clipboard
Copied
Indeed, Mark. Thanks for reminding and sharing your script.
Thanks, Ton, for reminding as well.
Copy link to clipboard
Copied
good one!! thank you for sharing the technique