2 Replies Latest reply on Dec 24, 2008 9:52 AM by Eric @ MCA

    AS to JS translation questions

    Eric @ MCA Level 3
      Hi all,

      Still trying to convert the same script from AS to JS and I've bogged down again.

      [1] I collect up a text range ala ID's print dialog (eg, 1-4, 5, 7) and then convert it into a list of document offsets (1, 2, 3, 4, 5, 7) that I can process in a loop. However, when I try and reference pages by those offsets, I am getting back different numbers.

      EDIT: Aha! for( thisPageOffset in offsetList ) wasn't returning what I thought it would. It's returning the index of the offsetList item not the actual value for some reason. Never mind about #1...

      [2] Secondly, a translation question. In Applescript, I can collect a list of every text frame with a certain script label by doing:

      set oldFrames to every text frame whose label = "myMarker"

      Is there a short-hand equivalent in JS or is something like this the only way:
      for( thisFrame in textFrames ) {
          if( thisFrame.label == "myMarker" ) {
              oldFrames = oldFrames.concat( thisFrame )

      Gads, it is difficult thinking in JS after years of doing AS!


      Thanks in advance,