Re: path to as string
Re: path to as string
- Subject: Re: path to as string
- From: Chaim Kram <email@hidden>
- Date: Wed, 29 Jun 2005 13:08:58 -0400
--On Wednesday, 29 June 2005 08:47 +1000 Shane Stanley
<email@hidden> wrote:
On 29/6/05 5:06 AM, "Christopher Nebel" <email@hidden> wrote:
What *I* don't understand (and [Matt] can answer this one in private) is
why any of this is relevant to users
Let me try this one: because in practice, the whole business of Unicode
text v string v MacRoman text causes all sorts of anomalies, and having
some knowledge of what's going on makes it much easier to track down
problems (and perhaps lessens the inclination to blame it all on
AppleScript).
For example (and you'll please pardon my not-so-advanced viewpoint on this,
but...):
I'm trying to extract plain text (no style information) out of the
clipboard. What I've been able to glean is that there are at least 3
disparate ways to do this, none of which are intuitive or discoverable in
the usual AppleScript ways:
(1) set x to the string of (the clipboard as record)
(2) set x to (the clipboard as text) as Unicode text
(3) set x to «class ktxt» of ((the clipboard as text) as record)
Several variations of this also do not work, though it seems that they
ought to:
(1a) set x to the Unicode text of (the clipboard as record)
(2a) set x to the clipboard as Unicode text
(3a) set x to «class ktxt» of (the clipboard as record)
Assuming the clipboard contains only styled text of the English variety
(meaning I'm in a text editor like Smile, and I select styled text and
choose "Copy"), and I'm running under 10.3.9 and not yet Tiger:
(1a) returns an error because there is no "Unicode text" property
in the record, only "string" (and it's supposedly deprecated?)
(2a) returns Chinese characters;
(3a) returns an error because there is no «class ktxt» when the
clipboard is coerced to a record without first coercing it
to text (and why is that? why does the "string" object get
changed to a «class ktxt» object when the clipboard is coerced
to text?)
Given that my users are mostly using 10.3.9 and will be migrating to Tiger
shortly, I just want to know what form above, (1), (2), or (3), is most
likely NOT to fail going forward. And if, just maybe, there's a slightly
more intuitive way of extracting the plain text from the clipboard. Thanks.
| Chaim Kram
| Information Technology Central Services
| The University of Michigan
| 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