• 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: Recent Items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recent Items


  • Subject: Re: Recent Items
  • From: Thomas Fischer <email@hidden>
  • Date: Mon, 14 Apr 2014 08:28:27 +0200

Yvan found a bug in my UTF-8 transformation.
If anybody wants to use something like this, here is the corrected version.
Also depending on the OS version, start to read at 59 (for OS 10.6.8) or 123 for Mavericks, I don't know for the in-betweens.
Also note that If you want to use this or something like this as a subroutine you need
set theChars to {}
set newChars to {}
at the to of your script.

Best
Thomas

on decipherAbookmark(n)
set my theChars to {} & the id of (text 123 thru -1 of n)
set my newChars to {}
set myCount to 0
set theResult to 0
set tooLow to false
set firstSum to 0
repeat with theid in my theChars
if theid > 96 then
set theNum to theid - 87
else if theid > 64 then
set theNum to theid - 55
else
set theNum to theid - 48
end if
if theNum ≥ 0 and theNum ≤ 16 then set theResult to 16 * theResult + theNum
set myCount to myCount + 1
if (myCount = 2) then
if theResult < 129 or theResult > 192 then
if firstSum ≠ 0 then
copy firstSum to the end of my newChars
set firstSum to 0
end if
end if
if theResult < 31 then
if not tooLow then
copy 47 to the end of my newChars
set tooLow to true
end if
else
set tooLow to false
# log "Test: " & theResult
if theResult < 129 then
copy theResult to the end of my newChars
else if theResult < 192 then
set firstSum to firstSum * 64 + (theResult - 128)
else if theResult < 224 then
set firstSum to firstSum * 64 + (theResult - 192)
else if theResult < 240 then
set firstSum to firstSum * 64 + (theResult - 224)
else if theResult < 245 then
set firstSum to firstSum * 64 + (theResult - 240)
end if
end if
if my newChars ends with {46, 97, 112, 112} then return character id (my newChars) #exit repeat
set theResult to 0
set myCount to 0
end if
end repeat
end decipherAbookmark

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Recent Items (From: "koenig.yvan" <email@hidden>)
 >Re: Recent Items (From: Shane Stanley <email@hidden>)
 >Re: Recent Items (From: "koenig.yvan" <email@hidden>)
 >Re: Recent Items (From: Thomas Fischer <email@hidden>)
 >Re: Recent Items (From: "koenig.yvan" <email@hidden>)
 >Re: Recent Items (From: Thomas Fischer <email@hidden>)

  • Prev by Date: Re: QuickTime Pro 7 Captions
  • Next by Date: Re: QuickTime Pro 7 Captions
  • Previous by thread: Re: Recent Items
  • Next by thread: NSString in ApplescriptObjC
  • Index(es):
    • Date
    • Thread