0 Replies Latest reply on Nov 12, 2014 8:48 AM by creativejoan0425

    Find Change all text not including table text

    creativejoan0425 Level 1

      I want to change the date format to (1 December 2009) in activeDocument but without table text, but seem error

      but if I change myP = app.documents.item(0); run through activeDocument, it can change all

       

       

      myP = app.activeDocument.stories.everyItem().words.everyItem().paragraphs.everyItem();

       

              app.findGrepPreferences= null;

              //001

              app.findGrepPreferences.findWhat = "(\\d{1,2}[\]]*|\[~8{3}\]) (?i)([\[]*January[\]]*|[\[]*February[\]]*|[\[]*March[\]]*|[\[]*April[\]]*|[\[]*May[\]]*|[ \[]*June[\]]*|[\[]*July[\]]*|[\[]*August[\]]*|[\[]*September[\]]*|[\[]*October[\]]*|[\[]*N ovember[\]]*|[\[]*December[\]]*),([ \r\n][~>~m]*)([\[]*\\d{4})";

              app.changeGrepPreferences.changeTo = "$1 $2$3$4";

              myP.changeGrep();

              //002

              app.findGrepPreferences.findWhat = "(\\d{1,2}[\]]*)(?i)(st[\]]*|nd[\]]*|rd[\]]*|th[\]]*) (?i)([\[]*January[\]]*|[\[]*February[\]]*|[\[]*March[\]]*|[\[]*April[\]]*|[\[]*May[\]]*|[ \[]*June[\]]*|[\[]*July[\]]*|[\[]*August[\]]*|[\[]*September[\]]*|[\[]*October[\]]*|[\[]*N ovember[\]]*|[\[]*December[\]]*)([ \r\n][~>~m]*)([\[]*\\d{4})";

              app.changeGrepPreferences.changeTo = "$1 $3$4$5";

              myP.changeGrep();

              //003

              app.findGrepPreferences.findWhat = "(\\d{1,2}[\]]*)(?i)(st[\]]*|nd[\]]*|rd[\]]*|th[\]]*) (?i)([\[]*January[\]]*|[\[]*February[\]]*|[\[]*March[\]]*|[\[]*April[\]]*|[\[]*May[\]]*|[ \[]*June[\]]*|[\[]*July[\]]*|[\[]*August[\]]*|[\[]*September[\]]*|[\[]*October[\]]*|[\[]*N ovember[\]]*|[\[]*December[\]]*),([ \r\n][~>~m]*)([\[]*\\d{4})";

              app.changeGrepPreferences.changeTo = "$1 $3$4$5";

              myP.changeGrep();

              //004

              app.findGrepPreferences.findWhat = "(?i)([\[]*January[\]]*|[\[]*February[\]]*|[\[]*March[\]]*|[\[]*April[\]]*|[\[]*May[\]]*| [\[]*June[\]]*|[\[]*July[\]]*|[\[]*August[\]]*|[\[]*September[\]]*|[\[]*October[\]]*|[\[]* November[\]]*|[\[]*December[\]]*) ([\[]*\\d{1,2}[\]]*|\[~8{3}\]),([ \r\n][~>~m]*)([\[]*\\d{4})";

              app.changeGrepPreferences.changeTo = "$2 $1$3$4";

              myP.changeGrep();

              //005

              app.findGrepPreferences.findWhat = "(\\d{1,2}[\]]*)(?i)(st[\]]*|nd[\]]*|rd[\]]*|th[\]]*) (?i)([\[]*January[\]]*|[\[]*February[\]]*|[\[]*March[\]]*|[\[]*April[\]]*|[\[]*May[\]]*|[ \[]*June[\]]*|[\[]*July[\]]*|[\[]*August[\]]*|[\[]*September[\]]*|[\[]*October[\]]*|[\[]*N ovember[\]]*|[\[]*December[\]]*)";

              app.changeGrepPreferences.changeTo = "$1 $3";

              myP.changeGrep();

              //006

              app.findGrepPreferences.findWhat = "(?i)([\[]*January[\]]*|[\[]*February[\]]*|[\[]*March[\]]*|[\[]*April[\]]*|[\[]*May[\]]*| [\[]*June[\]]*|[\[]*July[\]]*|[\[]*August[\]]*|[\[]*September[\]]*|[\[]*October[\]]*|[\[]* November[\]]*|[\[]*December[\]]*) ([\[]*\\d{1,2}[\]]*)([ \r\n\,])(.)";

              app.changeGrepPreferences.changeTo = "$2 $1$3$4";

              myP.changeGrep();

              //007

              app.findGrepPreferences.findWhat = "(\\[*\\d{1,2}\\]*|\\[~8{3}\\])[/~=\.](\\[*\\d{1,2}\\]*|\\[~8{3}\\])[/~=\.](\\[*\\d{4}\\] *|\\[~8{3}\\])";

              app.changeGrepPreferences.changeTo = "$1@@$2@@$3";

              myP.changeGrep();

              //008

              app.findGrepPreferences.findWhat = "@@([\[]*)0?1([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1January$2 ";

              myP.changeGrep();

              //009

              app.findGrepPreferences.findWhat = "@@([\[]*)0?2([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1February$2 ";

              myP.changeGrep();

              //010

              app.findGrepPreferences.findWhat = "@@([\[]*)0?3([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1March$2 ";

              myP.changeGrep();

              //011

              app.findGrepPreferences.findWhat = "@@([\[]*)0?4([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1April$2 ";

              myP.changeGrep();

              //012

              app.findGrepPreferences.findWhat = "@@([\[]*)0?5([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1May$2 ";

              myP.changeGrep();

              //013

              app.findGrepPreferences.findWhat = "@@([\[]*)0?6([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1June$2 ";

              myP.changeGrep();

              //014

              app.findGrepPreferences.findWhat = "@@([\[]*)0?7([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1July$2 ";

              myP.changeGrep();

              //015

              app.findGrepPreferences.findWhat = "@@([\[]*)0?8([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1August$2 ";

              myP.changeGrep();

              //016

              app.findGrepPreferences.findWhat = "@@([\[]*)0?9([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1September$2 ";

              myP.changeGrep();

              //017

              app.findGrepPreferences.findWhat = "@@([\[]*)10([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1October$2 ";

              myP.changeGrep();

              //018

              app.findGrepPreferences.findWhat = "@@([\[]*)11([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1November$2 ";

              myP.changeGrep();

              //019

              app.findGrepPreferences.findWhat = "@@([\[]*)12([\]]*)@@";

              app.changeGrepPreferences.changeTo = " $1December$2 ";

              myP.changeGrep();

              //020

              app.findGrepPreferences.findWhat = "@@(\\[~8{3}\\])@@";

              app.changeGrepPreferences.changeTo = " $1 ";

              myP.changeGrep();

              //021

              app.findGrepPreferences.findWhat = "0(\\d\\]*) (?i)(\\[*January\\]*|\\[*February\\]*|\\[*March\\]*|\\[*April\\]*|\\[*May\\]*|\\[*June\\] *|\\[*July\\]*|\\[*August\\]*|\\[*September\\]*|\\[*October\\]*|\\[*November\\]*|\\[*Decem ber\\]*|\\[~8{3}\\]) (\\[*\\d{4}\\]*|\\[~8{3}\\])";

              app.changeGrepPreferences.changeTo = "$1 $2 $3";

              myP.changeGrep();

      alert("Done");

       

      未命名-1.jpg