JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 4th, 2012, 03:39 PM
brianedl brianedl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 6 brianedl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 50 m 19 sec
Reputation Power: 0
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(/ ***?Y+$| ***?Y - | ***?Y -| ***?Y | ***?Y- | ***?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, "* ");

Reply With Quote
  #2  
Old December 4th, 2012, 07:32 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,875 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 4 h 14 m 32 sec
Reputation Power: 813
Cross-posted at webdeveloper.com, codingforums.com and who-knows-where.

Reply With Quote
  #3  
Old December 5th, 2012, 08:19 AM
brianedl brianedl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 6 brianedl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 50 m 19 sec
Reputation Power: 0
This is to work in Illustrator CS5

I forgot to mention that this needs to work in Illustrator CS5.

Reply With Quote
  #4  
Old December 6th, 2012, 01:04 PM
brianedl brianedl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 6 brianedl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 50 m 19 sec
Reputation Power: 0
Jacques1,

Is it a problem posting my question on different forums? I have been working hard to understand Javascript & need some help. Please let me know if this is a problem & if so why? If not then what is the point of your non helpful reply?

Reply With Quote
  #5  
Old December 19th, 2012, 12:09 PM
brianedl brianedl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 6 brianedl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 50 m 19 sec
Reputation Power: 0
This is what I came up with

Code:
if ( app.documents.length > 0 && app.activeDocument.textFrames.length > 0 ) {
// Set the value of the word to look for
searchWord1 = "*";
//searchWord2 = "The";

// Iterate through all words in the document
// the words that match searchWord
for ( i = 0; i < app.activeDocument.textFrames.length; i++ ) {
textArt = activeDocument.textFrames[i];
for ( j = 0; j < textArt.characters.length; j++) {
word = textArt.characters[j];
if ( word.contents == searchWord1 ) {

word.verticalScale = 120;
word.horizontalScale = 140;
word.baselineShift = -3;
}
}
}
}

Reply With Quote
  #6  
Old December 19th, 2012, 04:56 PM
Winters Winters is offline
Super Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jul 2003
Posts: 3,874 Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 17 h 24 m 7 sec
Reputation Power: 2569
Cross-posting annoys everyone involved. If we answer your question here, then you have other groups of people spending their spare time to help you for no reason at all. You may not have considered this viewpoint.
__________________
[PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

W3Fools - A W3Schools Intervention.

Reply With Quote
  #7  
Old December 20th, 2012, 08:52 AM
brianedl brianedl is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 6 brianedl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 50 m 19 sec
Reputation Power: 0
I did not think of this, but keep in mind that as soon as I get the solution I put that answer on the other forums I also might get a different & better answer from someone else also there will be in this case 3 places to find this solution if someone else needs something similar. This sounds like 3 pro's compared to your concern. What do you think?

I DID NOT INTEND TO BOTHER OR OFFEND ANYONE & AM, SORRY. I ALSO DON'T LIKE THAT Jacques1 MAKES HIS COMMENT & THEN NEVER RESPONDS.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Combine Find & Replace Code for Illustrator

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap