Fur Posted January 11, 2005 Share Posted January 11, 2005 Trying to understand how AutoIt converts between strings/numbers with Hex/Dec functions. I end up banging my head because of all these weird language quirks. Can someone explain to me why the first two cases work and the second two don't? ; we work MsgBox(0, "Test: ", 0xAABBCC ) MsgBox(0, "Test: ", Dec("AABBCC") ) ; we dont MsgBox(0, "Test: ", Dec(0xAABBCC) ) MsgBox(0, "Test: ", Dec("0xAABBCC") ) Link to comment Share on other sites More sharing options...
Wolvereness Posted January 11, 2005 Share Posted January 11, 2005 (edited) Correct syntax from helpfile:$dec = Dec("FFFF");returns the number 65536 To explain this, it's just the way they made autoit Edit: typo Edited January 11, 2005 by Wolvereness Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote] Link to comment Share on other sites More sharing options...
Fur Posted January 12, 2005 Author Share Posted January 12, 2005 Not exactly the answer I was hoping for.. Link to comment Share on other sites More sharing options...
Helge Posted January 12, 2005 Share Posted January 12, 2005 I'm unable to test, but I think you have to remove the 0x for use with Dec().. Link to comment Share on other sites More sharing options...
Blue_Drache Posted January 12, 2005 Share Posted January 12, 2005 If a function is returning a hexidecimal number in 0xABCDEF format, just stringtrim the 0x off Function returns a hex in variable $hex A StringTrimLeft($hex,2) would be your best bet then to convert it with the Dec() function. Thus resulting in: Dec(StringTrimLeft($hex,2)) Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now