2 Replies Latest reply on Oct 27, 2012 2:41 PM by MatthewMariani

    From Pagemaker to InDesign

    felisje

      Hi all,

       

      I have some scripts in Pagemaker which I would like to rewrite for InDesign.

      Basically (in PM), I import a text, set cursor to start posistion, select pieces of the text (like End Of Line) and format it (font, color, ...)

      Also look for text delimiters (;), change them to tabs, carriage returns (this part - find and replace - is no problem),

      I have searched quite a bit, but have not found yet how to place the 'cursor' e.g. at the beginning of the text, move the cursor e.g. to the end of the line or 3 lines down, left 3 characters or right 1 character, so I can select characters from the cursor position.

      I really would appreciate some hints in which direction I have to look for solutions for my problem.

       

      Thanks,

      Leo

        • 1. Re: From Pagemaker to InDesign
          felisje Level 1

          And I tried to remember to mention that I work on a Windows machine, ID CS5, prefer VBA, but also like JS.

          Sorry,

          Leo

          • 2. Re: From Pagemaker to InDesign
            MatthewMariani Level 1

            Leo,

             

            The way PageMaker scripting worked was very different and sort of mirrored the way things work in the user interface of the program. With an InDesign script, it's not really necessary--or even desirable, some would say--to select specific elements in order to act on them.

             

            Assuming that the variable stry contains a reference to an InDesign story:

             

            The following JavaScript would set the font style of the third word in the second line of the story to "Bold Italic" regardless of what is selected in the document.

            stry.lines[1].words[2].fontStyle = "Bold Italic";

             

            The following JavaScript would set the font style of characters 6 through 19 in the first line of the story to "Bold Italic" regardless of what is selected in the document.

            stry.lines[0].characters.itemByRange( 5, 18 ).fontStyle = "Bold Italic";

             

            Of course this also assumes that the story in question has at least two lines, that the first line contains at least 19 characters, the second line contains at least three words, and the font applied to the text actually has a font style called "Bold Italic".

             

            Matthew