7 Replies Latest reply on Sep 17, 2008 7:31 AM by (Dave_Saunders)

    Find Change script behaving oddly

      I've just gone back to a job that I do twice a year and found that the find change script isn't behaving as it had previously.

      If I make a text selection and then run the script, it does nothing. If I don't have anything selected then it runs, but throughout the whole document. I'm sure previously it was able to run on just the selected text, and this is what I need it to do.

      I've tried re-downloading the sample CS3 scripts and running findchange with the default values - but I get the same behaviour. Has something fundamental changed to break it or is there a simple solution?

      Can anyone help me get it working again please?

      Running CS3 5.0.3 on OSX 10.5.4.

      Thanks
        • 1. Re: Find Change script behaving oddly
          Level 1
          Steve,

          Is this the first time you've used this script with CS3?

          What is the script supposed to do? Which language is it written in? When you say it doesn't work on a selection -- does the selection in question actually have some text in it that applies? When you say it runs against the whole document when you have nothing selected, does it actually do anything to the document?

          Who wrote the script? From where did you download it?

          Dave
          • 2. Re: Find Change script behaving oddly
            Level 1
            Thanks for taking the time to reply Dave.

            I have used it with CS3 before, and I am pointing it at a text selection that it can affect.

            In trying to troubleshoot why the script wasn't working I went back to the beginning and re-downloaded the CS3 sample scripts from Adobe. It is the Adobe sample script, find/change (javascript) that I am using. I ran the find/change script with the settings it comes with - remove double spaces etc - but it exhibited exactly the same behaviour.

            If I have some text selected nothing happens when I run the script. If I have nothing selected then the script runs, and targets all the text in the document. Changing double spaces etc throughout. If I run my version (with the edited find/change support file) it finds and changes text correctly as well, but I am trying to limit it to the text selected.

            All I had done to it was add some new items to find/change. The fact that when I run the script with the default settings supplied and it still exhibits the same behaviour seems to rule out that it is caused by any of my changes.

            Any suggestions you can offer would be much appreciated.

            Steve
            • 3. Re: Find Change script behaving oddly
              Level 1
              While I don't profess to understand how to script - the following, first, part of the find/change javascript appears to be the part that is not functioning.

              It looks to me as if it is looks to see if I have made a selection and then, IF NOT, it applies the script to the whole document. But in my case it simply does nothing when I have a selection made. Any ideas anyone - please?

              main();
              function main(){
              var myObject;
              var myCheckSelection = false;
              if(app.documents.length > 0){
              if(app.selection.length > 0){
              switch(app.selection[0].constructor.name){
              case "InsertionPoint":
              case "Character":
              case "Word":
              case "TextStyleRange":
              case "Line":
              case "Paragraph":
              case "TextColumn":
              case "Text":
              myObject = myDisplayDialog();
              myCheckSelection = myObject[1];
              myObject = myObject[0];
              if(myObject != "None"){
              myFindChangeByList(myObject, myCheckSelection);
              }
              break;
              default:
              myFindChangeByList(app.documents.item(0), false);
              }
              }
              else{
              //Nothing was selected, so simply search the document.
              • 4. Re: Find Change script behaving oddly
                Level 1
                Ah, it looks as though you are suffering the neverInteract problem.

                Try inserting, after the line case "Test":

                app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll

                Or, just set that up as a one-line script and run it whenever you encounter this behavior. Any script that puts up a dialog, should look after this, but the sample scripts don't.

                Dave
                • 5. Re: Find Change script behaving oddly
                  Level 1
                  Thanks Dave -it works perfectly!

                  I really appreciate the help.

                  Steve


                  On 11/09/2008, at 11:56 PM, Dave Saunders wrote:

                  A new message was posted by Dave Saunders in

                  InDesign Scripting --
                    Find Change script behaving oddly

                  Ah, it looks as though you are suffering the neverInteract problem.

                  Try inserting, after the line case "Test":

                  app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll

                  Or, just set that up as a one-line script and run it whenever you encounter this behavior. Any script that puts up a dialog, should look after this, but the sample scripts don't.

                  Dave


                  View/reply at Find Change script behaving oddly
                  Replies by email are OK.
                  Use the unsubscribe form to cancel your email subscription.


                  • 6. Re: Find Change script behaving oddly
                    Hi my actual problem is, i need to find the trademark and make it superscript. but if i try to find the trademark using the script

                    app.findTextPreferences.findWhat = \u2122;

                    it shows an TM is undefined. please help to solve my issue.
                    • 7. Re: Find Change script behaving oddly
                      Level 1
                      You need:

                      app.findTextPreferences.findWhat = "\u2122";

                      Dave