4 Replies Latest reply on Dec 12, 2016 8:00 AM by miz sue

    InDesign CS6 script error - FindChangebyList

    miz sue Level 1

      Hello,

       

      I have updated my copy of findchangebylist.js. I added two more changes. When I run the script, I get this error:

       

      script error.PNG

       

      I've opened the script in an editor but I don't know what the problem is. I've copied the part which includes Line 159

       

      js script.PNG

       

      Can anyone determine what the problem is? I'm running InDesign CS6 (infrequently) on a pc.

       

      Thanks,

       

      Sue

        • 1. Re: InDesign CS6 script error - FindChangebyList
          rob day Adobe Community Professional & MVP

          The error isn't likely coming from the .jsx code but from the text file the script loads with the find and change lines (/FindChangeSupport/FindChangeList.txt).

           

          I assume you have edited that file and not the FindChangeByList.jsx code? You could easily introduce an error if the text file has a typo or was edited incorrectly.

           

          Below is the text file as it ships with ID. The highlight text are the find and change commands and everything above  is instruction text. You could make a copy the text file for future reference and delete all of the instruction text (in case there are some missing // comment tags, which would cause an error.

           

          The grep and text find and change examples have to be edited carefully.

           

          This is correct:

          grep    {findWhat:"  +"}    {changeTo:" "}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

           

          But this would throw an error because of the missing " after findWhat:"  +

          grep    {findWhat:"  +}    {changeTo:" "}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

           

          Also, you have to edit the text file in a plain text editor (not an app like Word). The correct " is not the same as

          Screen Shot 2016-12-10 at 7.47.32 AM.png

          • 2. Re: InDesign CS6 script error - FindChangebyList
            rob day Adobe Community Professional & MVP

            If you need the original text file here it is. Note that you don't need the instruction lines 1-30:

             

            //FindChangeList.txt
            //A support file for the InDesign CS4 JavaScript FindChangeByList.jsx
            //
            //This data file is tab-delimited, with carriage returns separating records.
            //
            //The format of each record in the file is:
            //findType<tab>findProperties<tab>changeProperties<tab>findChangeOptions<tab>description
            //
            //Where:
            //<tab> is a tab character
            //findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).
            //findProperties is a properties record (as text) of the find preferences.
            //changeProperties is a properties record (as text) of the change preferences.
            //findChangeOptions is a properties record (as text) of the find/change options.
            //description is a description of the find/change operation
            //
            //Very simple example:
            //text    {findWhat:"--"}    {changeTo:"^_"}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all double dashes and replace with an em dash.
            //
            //More complex example:
            //text    {findWhat:"^9^9.^9^9"}    {appliedCharacterStyle:"price"}    {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}    Find $10.00 to $99.99 and apply the character style "price".
            //
            //All InDesign search metacharacters are allowed in the "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences.
            //
            //If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped"
            //as shown in the example below:
            //
            //{findWhat:"\\s+"}
            //
            
            
            grep    {findWhat:"  +"}    {changeTo:" "}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all double spaces and replace with single spaces.
            grep    {findWhat:"\r "}    {changeTo:"\r"}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all returns followed by a space And replace with single returns.
            grep    {findWhat:" \r"}    {changeTo:"\r"}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all returns followed by a space and replace with single returns.
            grep    {findWhat:"\t\t+"}    {changeTo:"\t"}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all double tab characters and replace with single tab characters.
            grep    {findWhat:"\r\t"}    {changeTo:"\r"}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all returns followed by a tab character and replace with single returns.
            grep    {findWhat:"\t\r"}    {changeTo:"\r"}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all returns followed by a tab character and replace with single returns.
            grep    {findWhat:"\r\r+"}    {changeTo:"\r"}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all double returns and replace with single returns.
            text    {findWhat:" - "}    {changeTo:"^="}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all space-dash-space and replace with an en dash.
            text    {findWhat:"--"}    {changeTo:"^_"}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}    Find all dash-dash and replace with an em dash.
            
            • 3. Re: InDesign CS6 script error - FindChangebyList
              miz sue Level 1

              Hi Rob!

               

              Thanks for your replies. I will go compare the files now. I hope it is as simple as the wrong punctuation : )

               

              I'll report back with the results.

               

              Thanks,

               

              Sue

              • 4. Re: InDesign CS6 script error - FindChangebyList
                miz sue Level 1

                Hi Rob,

                 

                I've gone back to the text file and removed the instruction lines (1-30) and removed my edits. I ran that script and didn't get the error. I put my three additional find/changes back into the script and ran it again. Again no error. Not sure what the error was but it cleared out now.

                 

                Thank you for your help and files!

                 

                Sue