Jump to content
Sign in to follow this  
Fur

Dec/Hex quirks

Recommended Posts

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") )

Share this post


Link to post
Share on other sites

Correct syntax from helpfile:

$dec = Dec("FFFF");returns the number 65536

To explain this, it's just the way they made autoit :idiot:

Edit: typo

Edited 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]

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...