www.webdeveloper.com
Results 1 to 3 of 3

Thread: Combine Find & Replace Code for Illustrator

Threaded View

  1. #1
    Join Date
    Oct 2012
    Posts
    5

    Combine Find & Replace Code for Illustrator

    I've been working hard on learning Regular Expressions & here is what I have so far.

    Code:
    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(/([NW]\d{6})-S[_-]/i, "$1-S??? ");
    myReplace(/_/gi, " ");
    myReplace(/(\d{6})-?\d{7}\/\d\d?\d?-/i, "-$1-");
    myReplace(/-INS-\d\d\/\d\d?-/i, "* ");
    myReplace(/ ASSEMBLY/gi, " ASY");
    myReplace(/ ASS?Y+$| ASS?Y - | ASS?Y -| ASS?Y | ASS?Y- | ASS?Y-/gi, " ASY - ");
    myReplace(/MCA-|DSC1-|DSC1|DS-C1-|DS-C1/i, "-");
    myReplace(/^DS-|^DI-|^PH-|MCA|^PAF-|^PAF|^FDR-|^FDR/i, "");
    myReplace(/ ?\(VIEW\)| ?\(VIE[W?)?]| ?\(VIE+$| ?\(VI+$| ?\(V+$| ?\(+$/i, "");
    myReplace(/([NW]\d{6})-S\/.-/i, "$1-S??? ");
    myReplace(/([NW]\d{6})-S\?\?\? SC /i, "$1-S??? SCREW ");
    myReplace(/--/gi, "-");
    Question: is their a way to apply, to a character, a specific Horizontal Scale (140%), Vertical Scale (120%), & Baseline Shift (-3pt)...

    I need to apply these to the * in the line myReplace(/-INS-\d\d\/\d\d?-/i, "* ");
    Last edited by BrianEdL; 12-04-2012 at 04:40 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles