2 Replies Latest reply on Mar 20, 2014 1:04 PM by riott.girl

    Applescript to Javascript Translation Help Needed

    riott.girl Level 1

      I need to have this Applescript translated so I can use on my Windows system.

       

      Is there anyone out there who could do this for me?

       

       

       

      set pText to ":  The quick brown fox jumps"

       

      tell application "Adobe InDesign CS6"

          set stylePage to make page at end of active document

          tell stylePage

              set t to make text frame with properties {geometric bounds:{0.5, 0.5, 10.5, 8}}

              set text column count of text frame preferences of t to 2

          end tell

       

          set s to every paragraph style of active document

       

          set contents of last insertion point of t to "Paragraph Styles"

          set applied paragraph style of paragraph (count of paragraphs of t) of t to item 2 of s

       

          repeat with x in s

              set sname to name of x

              set contents of last insertion point of t to return & return & sname & pText

              set applied paragraph style of paragraph (count of paragraphs of t) of t to x

          end repeat

       

          set c to every character style of active document

       

          set contents of last insertion point of t to return & return & return & return & "Character Styles"

          set applied paragraph style of paragraph (count of paragraphs of t) of t to item 2 of s

       

          repeat with i in c

              set cname to name of i

              set contents of last insertion point of t to return & return & cname

              set applied character style of every word of paragraph (count of paragraphs of t) of t to i

          end repeat

      end tell

        • 1. Re: Applescript to Javascript Translation Help Needed
          Jump_Over Level 5

          Hi,

           

          #target indesign
          
          var 
                    pText = ":  The quick brown fox jumps",
                    t = app.activeDocument.pages.add().textFrames.add({geometricBounds: [0.5,0.5,10,8]}),
                    s = app.activeDocument.allParagraphStyles,
                    c = app.activeDocument.allCharacterStyles,
                    sname, cname, k;
          
          t.textFramePreferences.textColumnCount = 2;
          t.insertionPoints[-1].properties = {contents: "Paragraph Styles", appliedParagraphStyle: s[1]};
          t.parentStory.appliedCharacterStyle = c[0];
          
          for (k = 0; k < s.length; k++) {
                    sname = s[k].name;
                    t.insertionPoints[-1].contents = "\r\r" + sname + pText;
                    t.words[-1].appliedParagraphStyle = s[k];
                    }
          
          t.insertionPoints[-1].contents = "\r";
          t.insertionPoints[-1].properties = {contents: "\r\r\rCharacter Styles", appliedParagraphStyle: s[1]};
          
          for (k = 0; k < c.length; k++) {
                    cname = c[k].name;
                    t.insertionPoints[-1].contents = "\r\r" + cname;
                    t.paragraphs[-1].appliedCharacterStyle = c[k];
                    }
          

           

          enjoy

           

          Jarek

          • 2. Re: Applescript to Javascript Translation Help Needed
            riott.girl Level 1

            Thank you!

             

            Works perfectly!!!

             

            Cheers,

            riottgirl