• 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
Converting Hex to binary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Converting Hex to binary


  • Subject: Converting Hex to binary
  • From: Bernardo Hoehl <email@hidden>
  • Date: Sat, 8 Jan 2005 17:40:17 -0200

Hi List!


I know that I over work my scripts all the time.

But this is common to newbyes. Ins't it?

I have this script that aparently is functional:


set theInput to "0309"

set HexList to every character of ("0123456789ABCDEF")

set binList to {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"}
set ConvertedBin to ""

repeat with i from 1 to the count of theInput
repeat with ii from 1 to the count of HexList
if item i of theInput is item ii of HexList then
set ConvertedBin to ConvertedBin & item ii of binList
end if
end repeat
end repeat
return ConvertedBin --returns "0000001100001001"


Please:

Could you comment my script?

I bet you would write it in a shorter way.

thanks!


Bernardo Höhl

Rio de Janeiro - Brazil
 _______________________________________________
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

  • Follow-Ups:
    • Re: Converting Hex to binary
      • From: deivy petrescu <email@hidden>
  • Prev by Date: Re: Scripting mail create a mailbox in a mailbox (folder)
  • Next by Date: Re: Printing PDFs doesn't?
  • Previous by thread: Re: Scripting mail create a mailbox in a mailbox (folder)
  • Next by thread: Re: Converting Hex to binary
  • Index(es):
    • Date
    • Thread