Wednesday, May 17, 2006

Go get XPress - Part 5

The 5th function, setSelection(aRange) is called to select a specified range of text in the current story. The tricky part is that it uses a separate line of script in order to place the cursor before a character. This case, you are given aRange parameter with zero value in the second element.

on setSelection(aRange)
  tell application "QuarkXPress"
    set aLocation to item 1 of aRange
    set aLength to item 2 of aRange
    if aLength = 0 then
      set selection to (insertion point before character aLocation of story 1 of current box)
      set selection to (text from character aLocation to character (aLocation + aLength - 1) of story 1 of current box)
    end if
  end tell
end setSelection

Well, it gets more and more complicated.


Post a Comment

<< Home