Re: QuarkXPress 4.11 script breaks in 6.5 - Why?
Re: QuarkXPress 4.11 script breaks in 6.5 - Why?
- Subject: Re: QuarkXPress 4.11 script breaks in 6.5 - Why?
- From: Peter Waibel <email@hidden>
- Date: Tue, 25 Apr 2006 12:14:35 +0200
Hi Dan,
some days ago I found a very usefull subroutine "AsText()" in this forum
and saved it to my disk.
Unfortunately I didn't find the post in the forum again.
There has been a lot of usefull informations about coercing text in
that thread.
I think the problem is, that XPress needs class string as arguments
but your varSearch and varReplace is probably international text!
If you do this in AS:
set varSearch to "WWW-" as international text
--set varSearch to "WWW-" as styled text
set varSearch to varSearch as string
return class of varSearch
--> string
But the class is still "international text"
(for AS "international text" must be somthing like a subclass)
The subroutine "AsText()" should solve your problem.
This code worked for me:
set varSearch to "WWW-" as international text
set varReplace to "ASD-" as styled text
set varSearch to AsText(varSearch)
set varReplace to AsText(varReplace)
tell application "QuarkXPress Passport"
tell document 1
set every text of every story where it is varSearch to varReplace
end tell
end tell
on AsText(str)
--coerce Unicode or other text to styled string to plain text
try
return (((str as string) as record)'s «class ktxt»)
end try
return str as string -- if plain text to begin with, or if real
Unicode, change to "?"
end AsText
Peter
Am 24.04.2006 um 20:46 schrieb Dan Feather:
Why won't this script line work w/ QuarkXPress 6.5? It worked fine
w/ 4.11.
-- script snip:
tell application "QuarkXPress"
tell document 1
set every text of every story where it is varSearch to varReplace
end tell
end tell
--
The error is -10006
If I replace the variable names with actual strings, it works fine.
Thinking
the problem had something to do with that, I tried the following:
set {varSearch, varReplace} to {"WWW-", "ASD-"}
set every text of every story where it is varSearch to varReplace
. . . and it worked fine.
I compared (using "log class of..") that command with mine and found
variables were all of class string. (Mine are set by display
dialog, so I
use a second line to change Unicode text to string.)
Anyway, it's taking me to the edge!
Many thanks,
Dan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40opix.de
This email sent to email@hidden
Grüße aus Berlin
Peter Waibel
--------------------------------
Opix AG
Peter Waiibel
Am Borsigturm 46
13357 Berlin
Fon: +49 30 4303 4421
Fax: +49 30 4303 4409
email@hidden
email@hidden
email@hidden
http://www.opix.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