Copy link to clipboard
Copied
Hello all,
I am very new to the scripting world but have an issue that I was unsuccessful in resolving myself through googling and searching around. It may be impossible due to illustrator's set up but I am looking for a script to find and replace strings of text throughout a document. I realize in indesign this would be easy as all get out, but due to other limitations I am forced to use Illustrator.
I would need the script to search and find strings in both text boxes and text objects (or 2 scripts could work). I would be looking for something to find and replace as well as style for instance, find AA and replace with AA(registration mark) and superscript the registration mark. I would need to be able to do this for multiple instances of this string on a document. Is something like this possible?
Thanks in advance!
There is a sample in the documentation:
See p240
Copy link to clipboard
Copied
There is a sample in the documentation:
See p240
Copy link to clipboard
Copied
These threads are helpful:
Trouble applying paragraph and character styles to text in Illustrator with a script
Re: RegExp search and replace, keep original text formatting
For your script it looks like you can create some kind of customized ScriptUI input box in which you can assign what characters or words get some graphic style - or manually styled via script by changing the baselineShift property of a characterAttributes of a textRange. Here's an example:
#target illustrator
function test(){
var doc = app.activeDocument;
var t = doc.textFrames[0];
alert(t.characters[0].characterAttributes.baselineShift); // 0 - no superscript
alert(t.characters[1].characterAttributes.baselineShift); // 3 - superscript is at 3 units
};
test();
Copy link to clipboard
Copied
Hi, robertouell !
You may try my extension panel – that born from topic that Silly-V​ was wrote above – now I just updated it to suit your needs
Short demo video
Installation zxp file
Install using ZXPInstaller
Copy link to clipboard
Copied
Wow that looks super useful!
Copy link to clipboard
Copied
Video unavailable...
Copy link to clipboard
Copied
Nice work, thank you for sharing!
Copy link to clipboard
Copied
Wow thank you all for your input and help! I definitely think what has been said will aide me. Will have to dive into it later this week and see what I can do.