Re: FADE DEAD
Re: FADE DEAD
- Subject: Re: FADE DEAD
- From: Giuliano Gavazzi <email@hidden>
- Date: Thu, 14 Mar 2002 14:03:41 +0000
At 10:43 pm -0800 2002/03/13, Jon Pugh wrote:
I suppose embedding this sequence in a script would be bad. Yes, it
is. Check this script out:
prop p : fromHex( "FADEDEAD")
-- it won't compile, but it does run, that's why it won't compile
on fromHex(hStr)
set hStr to hStr as string
copy "0123456789ABCDEF" to hConst
copy 0 to theres
copy (length of hStr) to cCnt
repeat with i from cCnt to 1 by -1
copy (offset of (character i of hStr) in hConst) to hVal
copy (hVal - 1) * (16 ^ (cCnt - i)) to newVal
copy theres + newVal to theres
end repeat
return theres
end fromHex
-- FADEDEAD in hex (not ASCII) is the end of script marker
-- Having one inside a script is invalid
-- FasdUAS is the beginning marker, it is also invalid
-- However, compiling this into a valid script works
It won't compile, but what causes it not to compile is when it runs
the initialization of the property. That's kind of twisted. I
should have
Are you sure? It does not compile even with a different string. It
looks like it cannot evaluate the property before the definition of
the handler (<<script>> doesn't understand the fromHex message).
On the other hand
on run
my test()
end
on fromHex(hStr)
...
end fromHex
property p : fromHex("FADEDEAD")
on test()
display dialog "done"
end test
will compile and work.
Giuliano
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.