Re: Converting Hexadecimal in Binary
        •        From: Alejandro Tejada
        •        Subject: Re: Converting Hexadecimal in Binary
        •        Date: Sun, 11 Jan 2004 02:28:37 -0800
on Sat Jan 10
Dar Scott wrote:

>You can move toUpper() out of the loop.


snip


on mouseUp

-- put the ticks into zxcv

  -- this line put the ticks into a variable to count
the time
  -- that takes to execute this handler. There are 60
ticks in a second

  put the imagedata of img 1 into asd
  delete char 1 of asd
  -- the first char of the imagedata is the alphadata
or maskdata

  repeat with i = 1 to length(asd) step 4
    get binaryDecode("H*", char i to i+2 of asd, v1)
    put v1 after fldhex
  end repeat

  put length(fldhex) into lenghtofldhex
  repeat with i = 1 to lenghtofldhex step 60 -- I want
60 chars per line
    put return & char i to (i+59) of fldhex after
fldhexa2
  end repeat

  put empty into fldhex
  put toUpper(fldhexa2) into fld "hex"
  put ((the ticks - zxcv) / 60) && "seconds to create
the hexadecimal data from binary imagedata"
end mouseUp

changed to this may make it (a lot) quicker: ### = change on mouseUp

--put the ticks into zxcv ### old HC way :^)
put the millisecs into zap ### if the img is small this shows more exactly the difference
-- this line put the ticks into a variable to count the time
-- that takes to execute this handler. There are 60 ticks in a second


put the imagedata of img "prep" into asd
delete char 1 of asd
-- the first char of the imagedata is the alphadata or maskdata
###
get binaryDecode("H*", asd, v1)
repeat with i = 1 to length(v1) step 8
put char i to i + 5 of v1 after fldhex
end repeat
###
put length(fldhex) into lenghtofldhex
repeat with i = 1 to lenghtofldhex step 60 -- I want 60 chars per line
put return & char i to (i+59) of fldhex after fldhexa2
end repeat
put empty into fldhex
put toUpper(fldhexa2) into fld "text"
--put ((the ticks - zxcv) / 60) && "seconds to create the hexadecimal data from binary imagedata"
###
put the millisecs - zap && "milliseconds to create the hexadecimal data from binary imagedata"


end mouseUp




But still, i feel curious to know WHY binaryencode() could put his results after a variable and binarydecode reports an error. The sintax of both functions is similar so, Where did originates this error?

put binaryDecode("H*", char i to i+2 of asd)after var
-- produces an error!

Of coarse it should be : get binarydecode("H*", char i to i+2 of asd,v1) put v1 after var

put binaryEncode("H*", char i to i+2 of asd)after var
-- works perfectly!

Thanks again Dar, for your extraordinary help
with this task.

al

Greetings, WA

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to