Adobe 0046100128056 Scripting Guide - Page 103
We can create a script that uses grep find in conjunction with text find/change operations to apply
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 103 highlights
CHAPTER 6: Text and Type Finding and Changing Text 103 This is a heading. This is body text. We can create a script that uses grep find in conjunction with text find/change operations to apply formatting to the text and remove the mark-up tags, as shown in the following script fragment (from the ReadPMTags tutorial script): var myDocument = app.documents.item; var myStory = myDocument.stories.item(0); myReadPMTags(myStory); Here is the myReadPMTags function referred to in the above script. function myReadPMTags(myStory){ var myName, myString, myStyle, myStyleName; var myDocument = app.documents.item(0); //Reset the findGrepPreferences to ensure that previous settings //do not affect the search. app.findGrepPreferences = NothingEnum.nothing; app.changeGrepPreferences = NothingEnum.nothing; //Find the tags (since this is a JavaScript string, //the backslashes must be escaped). app.findGrepPreferences.findWhat = "(?i)^"; var myFoundItems = myStory.findGrep(); if(myFoundItems.length != 0){ var myFoundTags = new Array; for(var myCounter = 0; myCounter