• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Insertion Point in Quark
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Insertion Point in Quark


  • Subject: Re: Insertion Point in Quark
  • From: Hans Haesler <email@hidden>
  • Date: Wed, 15 Dec 2004 17:44:45 +0100

On Wed, 15 Dec 2004, Frank Renner wrote:

>I can easily get the "position" (i.e. 105/113) of the selection with:
>
>get (offset of first character of selection) + 1
>get (offset of last character of selection) + 1
>
>If the selection is an insertion point, this does not work anymore:
>
>insertion point after character 104 of text flow 1 of text box 41 of
>document "myDoc" of application "QuarkXPress Passport"

Frank,

what version of QuarkXPress are you using? With QXP 4.11 this works:
---
tell document 1 of application "QuarkXPress 4.11"
  tell selection
    if contents is not "" then
      set firstChar to (offset of character 1) + 1
      set lastChar to (offset of character -1) + 1
    else
      set firstChar to offset + 1
      set lastChar to firstChar
    end if
  end tell
end tell
{firstChar, lastChar}
-->{105, 105}

But I fear that you're using QXP 6.x where the offset of the
insertion point isn't available easily. Here is a workaround.
But you'll need the Scripting Addition "Satimage.osax".
The script tries to get the 'text style range' of the selection.
This generates an error message which is trapped and queried:
---
tell document 1 of application "QuarkXPress 6.5"
  if contents of selection is not "" then
    set firstChar to (offset of character 1 of selection) + 1
    set lastChar to (offset of character -1 of selection) + 1
  else
    set objRef to object reference of selection
    try
      set tsr to text style range of objRef
    on error errMsg
      set firstChar to ((change "(.*)(character )([0-9]+)(.*)" into ¬
        "\\3" in errMsg with regexp) as integer) + 1
      set lastChar to firstChar
    end try
  end if
end tell
{firstChar, lastChar}
-->{105, 105}

Please check out <http://www.dtpro.de/phpBB2/>
(Da werden Sie geholfen ;-)

---
Hans Haesler <email@hidden>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Insertion Point in Quark
      • From: Frank Renner <email@hidden>
References: 
 >Insertion Point in Quark (From: Frank Renner <email@hidden>)

  • Prev by Date: Re: Delay x return, how reliable, fast or slow is AppleScript?
  • Next by Date: Re: Frank Macleod/QNM Markham/QW1/CA is out of the office.
  • Previous by thread: Insertion Point in Quark
  • Next by thread: Re: Insertion Point in Quark
  • Index(es):
    • Date
    • Thread