1 Reply Latest reply on Feb 3, 2010 1:15 AM by HarboSenior

    Grep behaviour in InCopy CS3 doesn't match behaviour in FindChangeList [JS]


      Experimenting with the FindChangeList, I have been testing grep changes in InCopy until I have them working, then copy and pasting them into the FindChangeList.txt file.


      In the case of searches involving paragraph or forced returns, I naturally have to delete the return and replace it with "\r" or "\n".


      When I run the script, it fails to make the change although it works when I use InCopy's grep change dialog.


      One example is:


      "grep    {findWhat:"([\l\u])\r([\l\u])"}    {changeTo:"$1$2"}    {includeFootnotes:true... " etc.


      Annoylingly, it is also possible to paste "findWhat" searches from the text file back into the program's grep change dialog and they find what I am looking for without a problem.


      Not all the changes I have been trying have failed, so to my knowledge there is nothing wrong with the text file.


      What's going on here?

        • 1. Re: Grep behaviour in InCopy CS3 doesn't match behaviour in FindChangeList [JS]
          HarboSenior Level 1

          Before posting my original message, I searched the forum for "FindChangeList" and found a couple of unsatisfactory messages and replies.


          After I posted, in the "More Like This" section I spotted a lengthy dialog, with many "big guns" contributing. Its title began "Iconsistent behaviour with findchange "


          The solution, it appears, is to use the RecordFindChange_CS3.jsx script in conjuction with the FindChangeByListCS4.jsx script, which does work with CS3.


          I was surprised to note when using the RecordFindChange that the escaping "\\" of backslashes is required.


          The list file I am using is being edited in Textwrangler and it is saved in Unicode (UTF-8) with Unix (LF).


          Warned to avoid Rich Text format, I had been prepared to take a hammer and chisel to a quarry... That would have baffled the archaeolgoists, stoneage regular expressions.


          After spending the bulk of a day's scripting on this, I hope this brief summary comes in useful to someone in my predicament.