1 Reply Latest reply on Apr 14, 2010 2:09 PM by HarboSenior

    Works in ExtendScript and not in Script Panel [JS, CS3]


      I've adapted the FindChangeByList script to work with a particular page.


      The trouble is a couple of text boxes need to be removed entirely.


      So I've included the lines:-


      var myDoc = app.activeDocument;

      var myPageItems = myDoc.allPageItems;

      for(var i=myPageItems.length-1;i>=0;i--)




      if (myPageItems[i].contents == "WIN £50"||myPageItems[i].contents == "WIN £100") {







      ... then the script gets down to doing the changes prescribed by the list


      myObject = app.documents.item(0);



      When I run the script in ExtendScript the boxes vanish as intended.


      But when I run it from the InDesign scripts panel, the text frames stay where they are and their contents get changed along with the contents of the other text frames.


      I've alt clicked the script in the scripts panel to make sure I've got the right script. It's one of those head-scratchy-am-I-going-dafter affairs.

        • 1. Re: Works in ExtendScript and not in Script Panel [JS, CS3]
          HarboSenior Level 1

          After testing the box deletion part in the scripts panel and thus checking that it wasn't the culprit, I saved the box deleter script and the specialised FindChangeFromList script in the InDesign Scripts folder (so they don't appear in the Scripts Panel) and wrote an Applescript which does two "do scripts". When run from the scripts panel this script does the job. Inelegant, I know, but ours is not to reason why, ours is to get it working.