• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: 'sort' command-alternative?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: 'sort' command-alternative?
      • From: Paul Berkowitz <email@hidden>
    • Re: 'sort' command-alternative?
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: 'sort' command-alternative? (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: top <rant-rant-rant-rant-rant> [you were warned;p]
  • Next by Date: Re: "on reopen" not called from Doc via cmd-tab
  • Previous by thread: Re: 'sort' command-alternative?
  • Next by thread: Re: 'sort' command-alternative?
  • Index(es):
    • Date
    • Thread