Re: Producing Unicode-only characters
Re: Producing Unicode-only characters
- Subject: Re: Producing Unicode-only characters
- From: kai <email@hidden>
- Date: Wed, 26 Oct 2005 02:34:44 +0100
On 25 Oct 2005, at 23:01, Nigel Garvey wrote:
Otherwise, as Chris mentioned, there's the temporary file approach.
You
need to set a suitable location for the file and perhaps delete it
after use:
on unicodeNumber(c)
set fref to (open for access file ((path to desktop as Unicode
text)
& "Utxt chr.txt") with write permission)
try
set eof fref to 0
write character 1 of c to fref
set n to read fref as short integer from 1
end try
close access fref
return n
end unicodeNumber
Neat. :-)
I often use the temporary items folder for stuff like this. It should
also be possible to deal with a run of characters in a similar way:
--------------------
on unicodeNumbers(t)
set fref to (open for access file ((path to temporary items as
Unicode text) & "Utxt chr.txt") with write permission)
try
set eof fref to 0
write t to fref
set l to read fref as short integer from 1
end try
close access fref
l as list (* coercion for single item only *)
end unicodeNumbers
set t to «data utxt0061006200630020304830943077» as Unicode text
unicodeNumbers(t)
--> {97, 98, 99, 32, 12360, 12436, 12407}
--------------------
---
kai
_______________________________________________
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