Finding and Changing "first word character syle" in text


i want search spesific word , replacing first founded word character style in text. :

"transfer istanbul airport morning flight adana.  meet , transfer antioch , place followers of jesus first called christians. here visit church of st. peter, grotto discovered crusaders , reputed cave church christians met in secret. @ mosaic museum in antioch see unusually rich collection of mosaics area. following visit @ museum, go seleucia pieria, ancient port town of antioch paul , barnabas set out on first journey , paul returned afterwards.  finaly, check hotel in antioch dinner , overnight. (b,d)"

 

this paragraph contains 4 antioch word. , want make bold first one.

 

this code code change of them bold. can me?

 

var mydocument = app.documents.item(0);  // clear old preferences app.findtextpreferences = nothingenum.nothing; app.changetextpreferences = nothingenum.nothing;  //set find options. app.findchangetextoptions.casesensitive = false; app.findchangetextoptions.includefootnotes = false; app.findchangetextoptions.includehiddenlayers = false; app.findchangetextoptions.includelockedlayersforfind = false; app.findchangetextoptions.includelockedstoriesforfind = false; app.findchangetextoptions.includemasterpages = false; app.findchangetextoptions.wholeword = false;  // characterstyle set bold font style app.changetextpreferences.appliedcharacterstyle = mycharacterstyle;     app.findtextpreferences.findwhat = "antioch"; app.changetextpreferences.changeto = "antioch"; mydocument.changetext(); 

hi,

 

try ...

var mydocument = app.documents.item(0);

// clear old preferences
app.findtextpreferences = nothingenum.nothing;
app.changetextpreferences = nothingenum.nothing;

//set find options.
app.findchangetextoptions.casesensitive = false;
app.findchangetextoptions.includefootnotes = false;
app.findchangetextoptions.includehiddenlayers = false;
app.findchangetextoptions.includelockedlayersforfind = false;
app.findchangetextoptions.includelockedstoriesforfind = false;
app.findchangetextoptions.includemasterpages = false;
app.findchangetextoptions.wholeword = false;

// characterstyle set bold font style
//rem app.changetextpreferences.appliedcharacterstyle = mycharacterstyle;  

app.findtextpreferences.findwhat = "antioch";
app.changetextpreferences.changeto = "antioch";
// rem mydocument.changetext();

var founditems = mydocument.findtext();

var founditem = founditems[0];

founditem.applycharacterstyle(mycharacterstyle, false);



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP