🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #1677

Find some characters and replace with character style...

#1677
From: thiyagus5
Date: Tue, 03 Feb 2009 10:06
50 lines
1970 bytes
Hi everyone,

The below script is to find some space characters and replacing with character style. Its working fine with InDesignCS2 MAC.

//InDesign CS2//

var myDoc = app.activeDocument;
with(app.activeDocument){
myNewCharStyle = characterStyles.add();
with(myNewCharStyle){
name= "x"
fontStyle = "Roman"
}}

app.findPreferences = null;
app.changePreferences = null;

myDoc.search("^>", false, false, undefined, undefined, {appliedCharacterStyle:"x"});
myDoc.search("^m", false, false, undefined, undefined, {appliedCharacterStyle:"x"});

////////

Now i am currently working in InDesignCS3, and i have also changed the script somewhat but its not working with CS3 MAC...

//InDesign CS3//

var myDoc = app.activeDocument;
if (myDoc.characterStyles.item ('x') == null)
   myDoc.characterStyles.add ({name: 'x'});
var myNewCharStyle = myDoc.characterStyles.item ('x');

with(myNewCharStyle){
name= "x"
fontStyle = "Roman"
}

function setupFindText(myFindTextPreferences, myChangeTextPreferences, myNewCharStyle) {
app.findTextPreferences = null;
app.changeTextPreferences = null;
app.findTextPreferences.findWhat = "^>";
app.changeTextPreferences.appliedCharacterStyle = myNewCharStyle;
app.findTextPreferences.findWhat = "^m";
app.changeTextPreferences.appliedCharacterStyle = myNewCharStyle;

//

can anyone help me for this. Thanks in advance.

Regards
Thiyagu
Technical Details
Message-ID: <59b7c3f6.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing

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