apart, that is. My sister and her husband are on the way to the hospital right now!
2 comments:
Anonymous
said...
set theInput to "01000100 01101111 01101110 00100111 01110100 00100000 01010000 01100001 01101110 01101001 01100011 00101110 00001010" set AppleScript's text item delimiters to " " set theBytes to text items of theInput set theWords to {} repeat with thisByte in theBytes set end of theWords to parse(thisByte) end repeat set theOutput to {} repeat with thisWord in theWords set end of theOutput to ASCII character thisWord end repeat set AppleScript's text item delimiters to " " display dialog theOutput as text
to parse(thisByte) set theCumulative to 0 set n to 1 set AppleScript's text item delimiters to "" set theseBits to text items of thisByte repeat with thisBit in theseBits set theFlag to ((item (9 - n) of theseBits)) as integer set thePower to 2 ^ (n - 1) as integer set theValue to theFlag * thePower set theCumulative to theCumulative + theValue set n to n + 1 end repeat return theCumulative end parse
2 comments:
set theInput to "01000100 01101111 01101110 00100111 01110100 00100000 01010000 01100001 01101110 01101001 01100011 00101110 00001010"
set AppleScript's text item delimiters to " "
set theBytes to text items of theInput
set theWords to {}
repeat with thisByte in theBytes
set end of theWords to parse(thisByte)
end repeat
set theOutput to {}
repeat with thisWord in theWords
set end of theOutput to ASCII character thisWord
end repeat
set AppleScript's text item delimiters to " "
display dialog theOutput as text
to parse(thisByte)
set theCumulative to 0
set n to 1
set AppleScript's text item delimiters to ""
set theseBits to text items of thisByte
repeat with thisBit in theseBits
set theFlag to ((item (9 - n) of theseBits)) as integer
set thePower to 2 ^ (n - 1) as integer
set theValue to theFlag * thePower
set theCumulative to theCumulative + theValue
set n to n + 1
end repeat
return theCumulative
end parse
oh, and don't forget to reset AppleScript's text item delimiters to ""
Post a Comment