Re: Binary [was Re: ASCII]
Re: Binary [was Re: ASCII]
- Subject: Re: Binary [was Re: ASCII]
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 22 Jan 2001 00:26:12 -0500
- Organization: [very little]
Arthur J Knapp wrote:
>
Date: Sat, 20 Jan 2001 13:06:48 -0500
>
Subject: Re: Binary [was Re: ASCII]
>
From: "Arthur J Knapp" <email@hidden>
>
To: email@hidden
>
>
> Date: Fri, 19 Jan 2001 15:56:07 -0500
>
> From: "Marc K. Myers" <email@hidden>
>
> Subject: Re: Binary [was Re: ASCII]
>
>
> Jolly Roger wrote:
>
>> on 1/19/2001 9:54 AM, Arthur J Knapp (email@hidden) wrote:
>
>> >>>> on 1/18/2001 8:01 AM, Emmanuel wrote:
>
>> >>>>> At 13:00 +0100 18/01/01, Robert Poland wrote:
>
>
> 01010111...
>
>
I got as far as
>
>
"What's the big deal about writing in hexidecimal? I think we should code
>
in binary, especially if we're getting paid by the"...
>
>
when some exclamation points got in the way. :(
Original message:
0101011101101000011000010111010000100111011100110010000001110100
0110100001100101001000000110001001101001011001110010000001100100
0110010101100001011011000010000001100001011000100110111101110101
0111010000100000011101110111001001101001011101000110100101101110
0110011100100000011010010110111000100000011010000110010101111000
0110100101100100011001010110001101101001011011010110000101101100
0011111100100000010010010010000001110100011010000110100101101110
0110101100100000011101110110010100100000011100110110100001101111
0111010101101100011001000010000001100011011011110110010001100101
0010000001101001011011100010000001100010011010010110111001100001
0111001001111001001011000010000001100101011100110111000001100101
0110001101101001011000010110110001101100011110010010000001101001
0110011000100000011101110110010100100111011100100110010100100000
0110011101100101011101000111010001101001011011100110011100100000
0111000001100001011010010110010000100000011000100111100100100000
0111010001101000011001010010000001101011011001010111100101110011
0111010001110010011011110110101101100101001000010000110100001101
0100110101100001011100100110001100100000010010110010111000100000
0100110101111001011001010111001001110011001000000011110001001101
0110000101110010011000110100000001000001011100000111000001101100
0110010101010011011000110111001001101001011100000111010001110011
0101010001101111010001110110111100101110011000110110111101101101
0011111000001101011010000111010001110100011100000011101000101111
0010111101000001011100000111000001101100011001010101001101100011
0111001001101001011100000111010001110011010101000110111101000111
0110111100101110011000110110111101101101000011010011010000110000
0011001000110000001000000101011100101110001100100011001000110000
0111010001101000001000000101001101110100001011100000110101000110
0110000101101001011100100111011001101001011001010111011100100000
0101000001100001011100100110101100101100001000000100111101001000
0010000000100000001101000011010000110001001100100011011000001101
0010100000110100001101000011000000101001001000000011001100110011
0011000100101101001100010011000000110111001101000000110100001101
0101101100110001001011110011000100111001001011110011000000110001
0010000000100000001100110011101000110101001100110011101000110000
0011100100100000010100000100110101011101
-- Binary Representation ===> ASCII Text
tell application "Tex-Edit Plus"
if not (exists window 1) or contents of window 1 is "" then
tell me
activate
display dialog "This script requires text in a window to
run" buttons {"Cancel"} default button 1 with icon stop
end tell
end if
set origText to contents of window 1
end tell
set {od, AppleScript's text item delimiters} to {AppleScript's text item
delimiters, ASCII character 13}
set origText to text items of origText
set AppleScript's text item delimiters to od
set origText to origText as text
set textList to characters of origText
repeat with aChar in textList
if aChar is not in {"0", "1"} then
display dialog "Characters other than \"0\" and \"1\" have been
detected in the " & [optn-L]
"input text" buttons {"Cancel"} default button 1 with icon stop
end if
end repeat
set charCnt to count of origText
set modCnt to charCnt mod 8
if modCnt is not 0 then
display dialog "The number of zeros and ones is not evenly divisible
by " & [optn-L]
"8" buttons {"Cancel"} default button 1 with icon stop
end if
set divCnt to charCnt div 8
set newStrng to ""
repeat with i from 1 to divCnt
set theBin to characters of (text from (i * 8 - 7) to (i * 8) of origText)
set ASCIINbr to 0
repeat with i from 7 to 0 by -1
set ASCIINbr to ASCIINbr + (((item (8 - i) of theBin) as
integer) * (2 ^ i))
end repeat
set newStrng to newStrng & (ASCII character ASCIINbr)
end repeat
tell application "Tex-Edit Plus"
activate
make new window with properties {name:(name of window 1) & " (in text)"}
set contents of window 1 to newStrng
end tell