17 Replies Latest reply on Mar 20, 2016 2:03 PM by Obi-wan Kenobi

    Why is There No Guidance for FindChangeList?

    Gary Niemeier Level 1

      Dear Adobe Forums,

       

      I am a very experienced user of InDesign, working on CS5.5 and EPUB production. I thought that using Adobe's provided "FindChangeList" JavaScript would be timesaver for preparing InDesign files for export to EPUB. But in my experience, despite spending days of time on it and bending over backward to code my queries carefully, FindChangeList does not work without endless error messages that, as a non-programmer, I am not able to decipher. I'm very frustrated and annoyed by what should be a much more user-friendly script! After all, wasn't the whole idea of "FindChangeList" to make multiple find-and-replace operations available to a user of InDesign?

       

      I've read Adobe's support file at the top of the FindChangeList.txt doc. Here are just a few questions.

       

      Why does it still say InDesign CS4 when it was provided with InDesign CS5.5?

       

      Why are there no examples of how to change one character style into another, or one paragraph style into another?

       

      What is the full list of "FindChangeOptions" available, and why isn't it provided somewhere?

       

      Why is  there no mention of the "FindChangeList" JavaScript in your own InDesignCS5_ScriptingGuide_JS, available for download?

       

      As just one example of how this script isn't working, I recently added the following to a script:

       

      text{appliedCharacterStyle:"subru"}{appliedCharacterStyle:"sub-title"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}
      text{appliedCharacterStyle:"subsource"}{appliedCharacterStyle:"sub-src"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}
      text{appliedCharacterStyle:"s1"}{appliedCharacterStyle:"sub-herb"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}
      text{appliedCharacterStyle:"s2"}{appliedCharacterStyle:"sub-herb"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}
      text{appliedCharacterStyle:"s3"}{appliedCharacterStyle:"sub-herb"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}

       

      When run, this returned the error message:

      Screen shot 2011-12-09 at 11.38.07 AM.png

       

      I don't want to get 20 responses from a mixed bag of InDesign users guessing at what's going on. What I need is for Adobe to tell me where is the information needed to run this script properly?

       

      I thought the whole point of "FindChangeList" was to quickly do batch changes. So far, it's been anything but. Either get this script working, provide the proper documentation, or retire it.

       

      Thanks, Gary Niemeier

        • 1. Re: Why is There No Guidance for FindChangeList?
          Haakenlid Level 3

          Like most of the users on the forum I'm not an Adobe employee, and I doubt that you will get an official Adobe response to your question. I'll still give you my opinion.

           

          The script findChangeByList.jsx is supplied with Adobe InDesign in a folder called /samples/JavaScript/.
          The reason for this is that these scripts are not primarily supplied as full features of InDesign, but as samples of what scripting can be used for and how to write your own scripts.
          Therefore they are not as user friendly or well documented as the regular features of the application.

          • 2. Re: Why is There No Guidance for FindChangeList?
            MatthewMariani Level 1

            Gary,

             

            I think you need to include the findWhat and changeTo properties, setting them to the empty string (open and close quotes), and it should work like so:

             

            text{findWhat:"", appliedCharacterStyle:"subru"}{changeTo:"", appliedCharacterStyle:"sub-title"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}

             

            All of the relevant options for this script can be found in the object model viewer which is accessed via the Help menu item in ExtendScript Toolkit which should have installed with InDesign CS 5.5.

             

            Matthew

            • 3. Re: Why is There No Guidance for FindChangeList?
              Gary Niemeier Level 1

              Thanks for your response, and I understand where you're coming from. But how hard would it be for Adobe to provide a few more examples at the top of the FindChangeList.txt doc, so that if one wants to change character or paragraph styles, you'd at least have something to go on? I thought the whole point of providing this script was that normal users of InDesign could tap into doing multiple find-n-replace operations quickly and easily. I'm more than willing to type everything correctly and follow their rules, if there are any to follow! If the script can't be used to do multiple character or paragraph style changes, then they should say so in the explanation. Or if such changes are possible, Adobe should at the very least simply provide a couple of examples, which would take them about 30 seconds, and would have saved me hours of frustration and wasted time. Having followed this script since an early version of InDesign, I know that the explanatory text hasn't changed for years.

              • 4. Re: Why is There No Guidance for FindChangeList?
                Gary Niemeier Level 1

                Matthew, thanks for your response. However, I've successfully changed single character styles from one to another without using the findWhat or changeTo properties at all. Adobe's example in the FindChangeList.txt suggests that you don't need them for styles -- only for actual text. (They don't make this very clear at all, but it seems to be suggested). Where I run into error messages is in including multiple character/paragraph style changes. No one has yet explained why that happens. (Also, if I do use the findWhat or changeTo properties to search for a style and replace it with the same style (one needs to do that for EPUB), InDesign will delete the affected text. Not what you want.)

                • 5. Re: Why is There No Guidance for FindChangeList?
                  MatthewMariani Level 1

                  Gary,

                   

                  In that case, I would use a grep:

                   

                  grep{findWhat:".", appliedCharacterStyle:"subru"}{changeTo:"$0", appliedCharacterStyle:"sub-title"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}

                   

                   

                  However, I don't believe the script supports paragraph styles specified as find or change preferences. Paragraph styles cannot be applied programatically using the name as a string; rather the name must be used to create an object reference which can then be assigned. This is just a difference in the nature of paragraph and character styles in the scripting object model, as I understand it. The way the script is written does not accomodate paragraph styles.  I think I recall learning this the hard way some years ago. And, yes, it would have been nice if someone had pointed that out. But that is the nature of scripting... 

                   

                  Matthew

                  • 6. Re: Why is There No Guidance for FindChangeList?
                    Gary Niemeier Level 1

                    Matthew, thanks again. GREP was an avenue I hadn't considered. Your solution will probably prevent InDesign from deleting the text, but it still doesn't explain why multiple changes won't run.

                     

                    In general, I've decided to use FindChangeList only for multiple text-based changes as they relate to EPUB tasks. For character and paragraph style work, which so clearly don't really work in this script, I'm moving over to an excellent plug-in from a developer in New Zealand called "Multi-Find/Change" (http://www.automatication.com/index.php?id=12). This works with InDesign 5.5 and uses Indy's own saved find/change queries to create sets where queries can be run as a batch.

                     

                    Gary

                    • 7. Re: Why is There No Guidance for FindChangeList?
                      [Jongware] Most Valuable Participant

                       

                      Gary Niemeier wrote:

                      [..]

                      What is the full list of "FindChangeOptions" available, and why isn't it provided somewhere?

                       

                       

                      (a) about those pesky FindChangeOptions

                       

                      The script works the way it does by feeding whatever you entered in the txt file directly into the "properties" of findText, changeTo, and findOptions in memory. That means that you have to use the same notation for all items exactly as if you were typing it in a standalone Javascript -- hence, the seemingly odd notation that requires the curly braces, the camelCase property names and the colons before new values. It certainly smells like a real programmer wrote this up and didn't care about user-friendliness (although an important point in favour is you can use any of the 11 find-and-change options and any of the about 50 (!!) find text options that are available, without having the programmer having to manually include each and every one).

                       

                      The full list of FindChangeOptions can be located -- with some difficulty -- in the ESTK's Help, or in my Friendly HTML pages at

                      http://jongware.mit.edu/idcsjs5.5/pc_FindChangeTextOption.html

                       

                      and the full list of every findable/changeable item is at

                      http://jongware.mit.edu/idcsjs5.5/pc_FindTextPreference.html

                      and

                      http://jongware.mit.edu/idcsjs5.5/pc_ChangeTextPreference.html (exactly the same except for 'findWhat' which is 'changeTo' here)

                       

                      They probably expected everyone to know this stuff ...

                       

                      (b) about your not-working line

                       

                      The script works just fine for me -- sorry! I just added this line

                       

                      text {appliedCharacterStyle:"code-bold"} {appliedCharacterStyle:"hyperlink"} {}

                       

                      and it Did What It Was Supposed To.

                      Are you by any chance using style groups in your document? Do read on, if you please.

                       

                      (c) about the Worthless Error Message

                       

                      I get exactly that error message if I feed a non-existing character style into it -- I tried your "subru" to "sub-title" one. It fails when either of these character styles does not exist in the main list. When both exist, it runs without a hitch.

                       

                      To get a more meaningful error message, change line #159 of FindChangeByList.jsx (it's the one inside the function 'myFindText')

                       

                      app.doScript(myString, ScriptLanguage.javascript);
                      

                       

                      into this:

                       

                      try {
                        app.doScript(myString, ScriptLanguage.javascript);
                      } catch (e)
                      {
                        alert ("Failed with input:\r"+myFindPreferences+"\r"+myChangePreferences);
                      }
                      

                      so at least you'll know what input line caused the failure.

                      • 8. Re: Why is There No Guidance for FindChangeList?
                        MatthewMariani Level 1

                        Hi Jongware,

                         

                        You wrote:

                         

                        "...you can use any of the 11 find-and-change options and any of the about 50 (!!) find text options that are available..."

                         

                        My experience has been that not all of the find and change text preference options are available. Notably, appliedParagraphStyle does not work in the context of this script. Have you been able to use appliedParagraphStyle as a find or change preference element successfully with this script? If you have, I'd sure like to learn that mojo!

                         

                        Matthew

                        • 9. Re: Why is There No Guidance for FindChangeList?
                          [Jongware] Most Valuable Participant

                          Matthew, I'm sorry but I cannot make it fail. I tried with both CS4 and CS5, it just won't Won't Work.

                          This line

                           

                          text {appliedParagraphStyle:"header"} {appliedParagraphStyle:"headline"} {includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}
                          

                           

                          does exactly what you would expect it to.

                           

                          Is the paragraph style you want to find or replace with in a style group? Do you get an error message, or does it just Not Do Anything? If you get an error message, does adding the alert as I showed above tell you what is wrong with your input file?

                          • 10. Re: Why is There No Guidance for FindChangeList?
                            [Jongware] Most Valuable Participant

                            Oh let's go nuts and compare the CS4 against the CS5 version. The only difference are these lines at the very top.

                             

                            CS4:

                            //FindChangeByList.jsx
                            //An InDesign CS4 JavaScript
                            /*  
                            @@@BUILDINFO@@@ "FindChangeByList.jsx" 2.0.0.0 10-January-2008
                            

                             

                            CS5:

                            //FindChangeByList.jsx
                            //An InDesign CS5 JavaScript
                            /*  
                            @@@BUILDINFO@@@ "FindChangeByList.jsx" 3.0.0 15 December 2009
                            

                             

                            Those are the only changes. Both are 210 lines. If you happen to use it on CS5.5, does it say something else?

                             

                            (Also interesting because one of Gary's Gripes is

                             

                            Why does it still say InDesign CS4 when it was provided with InDesign CS5.5?

                             

                            which is ... puzzling ...)

                             

                            I don't have a CS5.5 nearby and can only check after the weekend.

                            • 11. Re: Why is There No Guidance for FindChangeList?
                              MatthewMariani Level 1

                              Right you are, Jongware. I was sure that the para style was not within a group but now I see that the document I was testing with has two instances of a para style with the same name, one of them inside a group and one not. I thought the latter was used in the document and not the former, but I was wrong. So that's why there was no error message--the script just didn't find what I told it to look for. Now it is working fine, even when I tried using both character and para style names specified in the find and change text prefs.

                               

                              This is good to know. Thanks for the reality check, Jongware!

                              • 12. Re: Why is There No Guidance for FindChangeList?
                                Gary Niemeier Level 1

                                Jongware,

                                 

                                Thank you for your in-depth responses! It's very good to have your link to Friendly HTML FindChange options. Much appreciated. I also love the tweak to the script you provided (for line 159). I'll put that in. You know, I do have success in running single "change one character style to another" or "change one paragraph style to another" operations. It's running multiple operations in the same script that cause the error messages. Also, re: your note about one of "Gary's Gripes" (you must have gotten that line from my wife), please note that I was referring to the text at the top of the FindChangeList.txt file, not the JavaScript itself. A minor quibble, but as I'm sure you'd agree, scripting—not to mention book design—is all about sweating the details. Since I moved my batch find/changes over to the InDesign plug-in "Multi-Find/Change" (http://www.automatication.com/index.php?id=12), I've enjoyed nary an error message... what a relief! As to the question of whether the FindChange script will actually do multiple character/paragraph operations, I'll run a test here this week. If I can make it fail (great way of thinking, by the way) I'll let you know here, and provide details. By the way, I got the plug-in link over at InDesign Secrets. David, Anne-Marie, what a group. Congrats on being one of their resident gurus.

                                • 13. Re: Why is There No Guidance for FindChangeList?
                                  Nbatyr

                                  Jongware, thanks for your insightful postings.  I have a case where the paragraph style I am trying to apply via findchangebylist.txt file happens to sit in a group/folder.  Considering that I am working with other people and cannot move the style outside of that folder could you kindly suggest how to make it work for me.

                                  grep{findWhat:”xyz”} {appliedParagraphStyle:”09 Action”} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

                                  The group/folder name is "Cover"

                                   

                                  Thanks.

                                  Batyr

                                  • 14. Re: Why is There No Guidance for FindChangeList?
                                    Jump_Over Level 5

                                    Hi,

                                     

                                    modify 2nd part like this:

                                    {...}     {appliedParagraphStyle: app.activeDocument.paragraphStyleGroups.item("Cover").paragraphStyles.item(”09 Action”) }     {...}

                                     

                                    Jarek

                                    • 15. Re: Why is There No Guidance for FindChangeList?
                                      Nbatyr Level 1

                                      Thank Jarek! 

                                      This helped a lot. I can now further optimize my workflow.

                                      BN

                                      • 16. Re: Why is There No Guidance for FindChangeList?
                                        pinakBERT

                                        How do I find...

                                         

                                        {findWhat:"\\$\\d+"}  with a specific paragraph style in a paragraph group?

                                         

                                        Because I need to change all prices to $000 but only in that paragraph style in a paragraph group.

                                         

                                        I have shipping prices in another paragraph style and same group, so I don't want these to change.

                                        • 17. Re: Why is There No Guidance for FindChangeList?
                                          Obi-wan Kenobi Adobe Community Professional

                                          Grep {findWhat:"\\$\\d+", appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("[1]").paragraphStyles .item(”[2]”) }

                                           

                                          [1] is your para styles group name

                                          [2]  is your specific para style name