🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #1686

Re: Find some characters and replace with character style...

#1686
From: Olav_Kvern
Date: Tue, 03 Feb 2009 18:11
35 lines
1647 bytes
Hi Thiyagu,

You're not telling InDesign CS3 to do anything here:



app.findTextPreferences.findWhat = "^>";  
app.changeTextPreferences.appliedCharacterStyle = myNewCharStyle;  
app.findTextPreferences.findWhat = "^m";  
app.changeTextPreferences.appliedCharacterStyle = myNewCharStyle;

You've set the find and change text preferences, but you haven't issued a command to change the text. What you need looks something more like this:



app.findTextPreferences.findWhat = "^>";  
app.changeTextPreferences.appliedCharacterStyle = myNewCharStyle; 
//Add a line to perform the change: 
app.documents.item(0).changeText(); 
app.findTextPreferences.findWhat = "^m";  
app.changeTextPreferences.appliedCharacterStyle = myNewCharStyle;  
//Add a line to perform the change: 
app.documents.item(0).changeText();

It's also not clear to me that this will work:



if (myDoc.characterStyles.item ('x') == null)

I think that this will always be true, even if the style does not exist.

Thanks,

Ole
Technical Details
Message-ID: <59b7c3f6.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newshub.sdsu.edu!webcrossing
References: <59b7c3f6.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,bbfbdca5e7f228aa
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Olav_Kvern@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: Find some characters and replace with character style...
Message-ID: <59b7c3f6.0@webcrossing.la2eafNXanI>
Date: Tue, 3 Feb 2009 10:11:54 -0800
References: <59b7c3f6.-1@webcrossing.la2eafNXanI>
Lines: 29
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit