4 Replies Latest reply on Sep 6, 2015 2:59 PM by Johnwhite

    How to change text only in cell

    Johnwhite Level 1

      Hi experts,

       

      How to find-change text only in the cell?

      How to make this script working?

       

               var
               mFCarray = [
                                  ["2030", "2031"], 
                                  ["2029", "2030"], 
                                  ["2028", "2029"], 
                                  ["2027", "2028"], 
                                  ["2026", "2027"], 
                                  ["2025", "2026"], 
                                  ["2024", "2025"], 
                                  ["2023", "2024"], 
                                  ["2022", "2023"], 
                                  ["2021", "2022"], 
                                  ["2020", "2021"], 
                                  ["2019", "2020"], 
                                  ["2018", "2019"], 
                                  ["2017", "2018"], 
                                  ["2016", "2017"], 
                                  ["2015", "2016"], 
                                  ["2014", "2015"], 
                                  ["2013", "2014"], 
                                  ["2012", "2013"]
                                  ],
                              myDocuments = app.documents.everyItem().stories.everyItem().tables.everyItem().cells.everyItem().texts. everyItem(),
                              cFCprefs;

                             app.findGrepPreferences = changeGrepPreferences = null; 
                             
                              while (cFCprefs = mFCarray.shift() ) {
                                  app.findGrepPreferences.findWhat = cFCprefs[0];
                                  app.changeGrepPreferences.changeTo = cFCprefs[1];
                                  myDocuments.changeGrep();
                                  }
                             
                              app.findGrepPreferences = changeGrepPreferences = null; 

       

      Regard

      John