Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Script Making Unwatted Formatting Changes

$
0
0

I picked up the following search and replace script online which works as inteded, except that it removes any italics I have and makes all of my text bold. Is there something I need to add/remove/replace to make it stop doing this?

 

Edit: It's doing even more in some files, including changing the size of my text. Also, it is only making these changes to any text box that has a string to be replaced.

 

function myReplace(search_string, replace_string) {    var active_doc = app.activeDocument;    var text_frames = active_doc.textFrames;    if (text_frames.length > 0)    {        for (var i = 0 ; i < text_frames.length; i++)        {            var this_text_frame = text_frames[i];            var new_string = this_text_frame.contents.replace(search_string, replace_string);            if (new_string != this_text_frame.contents)            {                this_text_frame.contents = new_string;                }            }        }    }
myReplace(/1\/8/gi, "\u215B" );

Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>