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.
And I tried to remember to mention that I work on a Windows machine, ID CS5, prefer VBA, but also like JS.
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:
stry.lines.words.fontStyle = "Bold Italic";
stry.lines.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".