1 Reply Latest reply on Jun 4, 2010 1:09 AM by Peter Kahrel

    [JS][CS3/4]

    Roy Marshall Level 1

      Hi.

       

      I am looking for some clarifications with syntax when coding for InDesign using Javascript.  I constantly find myself using 2 or 3 different ways to use the code before I either find the correct way, or lookup and old script, or posting on here. 

      I generally have the right ideas, and am using the right functions, but at times try them in the wrong way.

      For example:

       

      why is this written...

      app.activeDocument.layoutWindows[0].screenMode = ScreenModeOptions.PREVIEW_TO_SLUG;

      where this is written:
      myDoc.allPageItems[n].fit(FitOptions.frameToContent);
      and at times options are applied using
      ...({xxxxxx:zzzzzz},{aaaaa:yyyyy})
      I feel I have been using this long enough to know this, but I dont.  Maybe if I had a good founding in Javascript before my fiddling with Indesign Javascript I would know the answers.
      All I am looking for is a quick tip on how to use the correct form of code.
      Sorry to bother, but I would like to get my head these principles.
      Roy

        • 1. Re: [JS][CS3/4]
          Peter Kahrel Adobe Community Professional & MVP

          Roy,

           

          "ScreenModeOptions.PREVIEW_TO_SLUG" is equivalent to "ScreenModeOptions.previewToSlug" -- they're just notational variants. The first format is what the ESTK uses, the second one is more generally JavaScript convention.

           

          ({x: y}) is the format used e.g. when you create an object:

           

          myPage.textFrames.add ({geometricBounds: myBounds, contents: "Blah"});

           

          Peter

          1 person found this helpful