I’m working on a script that has a section in which the current line (with that I mean the line with the insertion point) should be copied. The insertion point should then move to the next line.
Copying the 1st line of a story is simple:
tell application "Adobe InDesign CS4"
select line 1 of text of parent story of selection
copy
end tell
But the current line is a bit more difficult, at least for me. I’ve tried something like this:
tell application "Adobe InDesign CS4"
set mySelection to selection
select line (get line of mySelection) of text of parent story of selection
copy
end tell
But that clearly does not work. Another thing is moving the insertion point to the next line. Any help much appreciated!
for example you could ask for the baseline of the selection to find the right line.
If you write the contents of the current and the following lines in a list, you could use this list to place its contents anywhere you want …
tell application "Adobe InDesign CS2"
set thebaseline to baseline of item 1 of selection --in this case: baseline of insertion point
set theline to item 1 of (lines of parent of item 1 of selection whose baseline is thebaseline) --contents of the line of insertion point ...
set thestory to parent of item 1 of selection --the story containing ...
set alllines to lines of thestory whose baseline ≥ thebaseline
(*list of contents of all lines >= ...
{"aute er se dio consed ", "molore faci eu feum ", "inim quamet augiam ", "diatum do odolore ", "consed magniam qui ", "blaor sed te cortio ", "commy nonsed tat ve", "liquisl ullaoreet, sum ", "vel et loreet luptat, ", "venisi bla augait wisi ", "bla faccum eugue tet ", "lum zzriureet adignia ", "mconulputate dolor se ", "tat, quat, commod tat. ", "Iriurem num adit nos"}
*)
end tell