11 Replies Latest reply on Jul 12, 2009 11:19 PM by mcolmenero

    ExtendScript for CS3 and CS2

    John.Kordas Level 1
      I recently created a CS3 script but also need to make a CS2 version for some of the PC's that have not moved over to CS3. I currently have both CS2 and CS3 installed on my PC for this reason.

      The issue I'm have is that ExtendScript for CS2 does not seem to work properly.

      For example in CS3 to add a layer I did:

      try{
      myDocument.layers.item("Slug").name;
      }
      catch (myError){
      myDocument.layers.add({name:"Slug"});
      }

      to achieve the same in CS2 I did:

      var mysluglayer, myactlayer;

      mysluglayer = app.activeDocument.layers.item("Slug");
      try{
      mysluglay = mysluglayer.name;
      }
      catch(myError){
      mysluglayer = app.activeDocument.layers.add({name:"Slug"});
      }

      Now when I run it in ExtendScript I get and error on:

      mysluglay = mysluglayer.name; ---> Object is invalid.

      If I run the script from ID CS2 the script works.

      Is this because I have 2 versions of ExtendScript on my PC?

      The other issue is I'm trying to set Layer 1 as the active layer after by:

      myactlayer = app.activeDocument.layers.activeLayer('Layer 1');
      try{
      myactlay = myactlayer.name
      }
      catch (myError){
      myactlayer = app.activeDocument.layers.item('Layer 1');
      }

      The error I get is app.activeDocument.layers.activeLayer is not a function

      Is this option available in CS2 or is it only available in CS3?