Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Text Replacement script

New Here ,
Jan 30, 2017 Jan 30, 2017

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!

TOPICS
Scripting
5.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Jan 30, 2017 Jan 30, 2017
Translate
Adobe
People's Champ ,
Jan 30, 2017 Jan 30, 2017
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 30, 2017 Jan 30, 2017

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:

2017-01-30 11_47_42-Untitled-1_ @ 439% (RGB_Preview).png

#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();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 30, 2017 Jan 30, 2017

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

Repository

Installation zxp file

Install using ZXPInstaller

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 30, 2017 Jan 30, 2017

Wow that looks super useful!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 12, 2017 Nov 12, 2017

Video unavailable...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 18, 2019 May 18, 2019
LATEST

Nice work, thank you for sharing!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 31, 2017 Jan 31, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines