Re: Insertion Point in Quark
Re: Insertion Point in Quark
- Subject: Re: Insertion Point in Quark
- From: Frank Renner <email@hidden>
- Date: Thu, 16 Dec 2004 10:27:47 +0100
Thanks, very helpful. Finally got it done with just string operations and
without using regular expressions from "Satimage.osax". The idea of parsing
the error string is cool! Why does Quark not support essential functions
like this anymore? It's like with a lot of other software products: they
call it upgrade, but it's a downgrade...
Thanks a lot,
Frank
Am 15.12.2004 17:44 Uhr schrieb "Hans Haesler" unter <email@hidden>:
> 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
--
informatikberatung Renner
Gewerbepark Erin
Karlstraße 8
D-44575 Castrop-Rauxel
Tel.: +49 (0) 2305 - 4408 - 70
Fax.: +49 (0) 2305 - 4408 - 71
Mobil: +49 (0) 172 - 2366252
Email: email@hidden
Web: www.i-renner.de
_______________________________________________
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