Re: 'sort' command-alternative?
Re: 'sort' command-alternative?
- Subject: Re: 'sort' command-alternative?
- From: John Delacour <email@hidden>
- Date: Sun, 6 Oct 2002 14:04:11 +0100
- Mac-eudora-version: 5.3 alpha
At 2:07 am -0700 6/10/02, Paul Berkowitz wrote:
Is there any way in AppleScript to get Unicode number of a given character?
'AE Print' in Script Debugger result window gives the double-byte hex form:
perhaps there's a way to do that in AppleScript itself? ('as data' doesn't
do it.) Those numbers are quite sortable after converting to decimal.
There may be a simpler way but this script will take a Unicode
character (in this case from a TextEdit window), convert it to a
decimal html entity anddisplay it in your browser.
tell app "TextEdit" to set s to get character 1 of document 1
set f to "tmp:junk.txt"
set f2 to "tmp:junk.html"
set s to TECConvertText s fromCode "UNICODE-2-0" toCode "UNICODE-2-0-UTF-8"
set s to TECConvertText s fromCode "UNICODE-2-0-UTF-8" toCode "UNICODE-2-0"
--
open for access file f with write permission
set eof file f to 0
write s to file f
close access file f
--
set pair to read file f
set n to 256 * (ASCII number (character 1 of pair))
set n to n + (ASCII number (character 2 of pair))
set htmlChar to "&#" & n & ";"
display dialog htmlChar
--
open for access file f2 with write permission
write "<html>" & htmlChar to file f2
close access file f2
tell app "Finder" to open file f2
I can't get Smile to convert it, so I've used the TEC osax.
JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.