Sign in to follow this  
Followers 0
sd333221

Autoit doesnt turn Dec into Hex properly -_-

10 posts in this topic

Autoit:

#include <string.au3>
$Dec = 123456789
$Hex = _StringToHex($Dec)
Msgbox(0, "I am too stupid to calcualte", $Hex)

Windows Calcualtor:

123456789 >> 75BCD15

Output Autoit:

313233343536373839

Output Windows Calculator:

75BCD15

:P

Share this post


Link to post
Share on other sites



Try this

#include <string.au3>
$Dec = 123456789
$Hex = _StringToHex($Dec, 8)
Msgbox(0, "I am too stupid to calcualte", $Hex)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

reversly... this works

$dec = Dec("75BCD15")  
MsgBox(0,"", $dec)

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

reversly... this works

$dec = Dec("75BCD15")  
MsgBox(0,"", $dec)

8)

Yesm but i dont need it reversly lol ^^

Share this post


Link to post
Share on other sites

$result = Hex(123456789)
MsgBox(0,"",$result)

This is what should be used to get the hex value of a number.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

$result = Hex(123456789)
MsgBox(0,"",$result)

This is what should be used to get the hex value of a number.

Uhmm thx,

are you the coder of autoit? ^^^^

You know it very well!

Nice...

Share this post


Link to post
Share on other sites

Uhmm thx,

are you the coder of autoit? ^^^^

You know it very well!

Nice...

No I can just read the help file and know the difference between numbers and strings :P


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Here's a revised function if you want:

$Dec = 123456789
$Hex = _revisedStringToHex($Dec)
Msgbox(0, "I am too stupid to calcualte", $Hex)

Func _revisedStringToHex($Dec)
    If $Dec < 16 Then
        Return Hex($Dec,1)
    Else
        Return _revisedStringToHex($Dec/16) & _revisedStringToHex(Mod($Dec,16))
    EndIf
EndFunc

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Hello,

Not so stupide because that's _StringToxHex converts STRING to hex. AutoIt converts every char from

$Dec = 1 2 3 4 5 6 7 8 9

to an Hex value...

HTH,

Francis

Share this post


Link to post
Share on other sites

Yesm but i dont need it reversly lol ^^

ok.... i knew that... and you already had an answer

just a way of checking... i always try to check my results reversly... i "was" great at math ... just slow due to checking like this

... still am slow too!.. ( just slower )

lol

8)


NEWHeader1.png

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  
Followers 0