Jump to content

PixelChecksum's return type ?


Drin
 Share

Recommended Posts

Hello,

While running a Hex( _ , 8 ) on a value returned by PixelChecksum, I am getting mixed results :

For $iCnt = 0 To 3

$iChk = PixelChecksum( $PosX[$iCnt], $PosY[$iCnt], $PosX[$iCnt] + 2, $PosY[$iCnt] + 3 )

_Log("PixelCheckSum( " & $PosX[$iCnt] & ", " & $PosY[$iCnt] & ", " & $PosX[$iCnt] + 2 & ", " & $PosY[$iCnt] + 3 & ") " & $iCnt & " : " & _

$iChk & " 0x" & Hex($iChk, 8) & " 0x" & Hex( Int( $iChk ), 8 ) )

Next

The result is below :

PixelCheckSum( 251, 551, 253, 554) 0 : 717754380 0x2AC8100C 0x2AC8100C

PixelCheckSum( 331, 551, 333, 554) 1 : 4261874088 0x80000000 0xFE0709A8

PixelCheckSum( 411, 551, 413, 554) 2 : 3449688091 0x80000000 0xCD9E101B

PixelCheckSum( 491, 551, 493, 554) 3 : 2024278997 0x78A80BD5 0x78A80BD5

Why Hex( 3449688091, 8 ) = 0x80000000 but Hex ( Int( 3449688091 ) , 8 ) = 0xFE0709A8 ?

What is the return type of PixelChecksum ?

Link to comment
Share on other sites

  • Moderators

Drin,

Welcome to the AutoIt forum. :)

Why Hex( 3449688091, 8 ) = 0x80000000 but Hex ( Int( 3449688091 ) , 8 ) = 0xFE0709A8 ?

I get the same result from both - as I would expect. :mellow:

What does this give you:

$iNum_1 = Hex(3449688091, 8)

$iNum_2 = Hex(Int(3449688091), 8)

MsgBox(0, "Result", $iNum_1 & @CRLF & $iNum_2)

I get CD9E101B for both.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thank you JohnOne, I'll try this tomorrow and I'll post the results.

Also, thank you M23 for your reply, but my question is somehow wrong :

Why Hex( 3449688091, 8 ) = 0x80000000 but Hex ( Int( 3449688091 ) , 8 ) = 0xFE0709A8 ?

The value 3449688091 is the value returned by PixelChecksum and stored in $iChk.

The correct question would be :

Why when $iChk = PixelChecksum( x1, y1, x2, y2 ) is 3449688091

Hex( $iChk, 8 ) = 0x80000000 but Hex ( Int( $iChk ) , 8 ) = 0xFE0709A8 ?

The below example is returning the correct value for both lines = 0xFE0709A8 :

$iNum_1 = Hex(3449688091, 8)

$iNum_2 = Hex(Int(3449688091), 8)

MsgBox(0, "Result", $iNum_1 & @CRLF & $iNum_2)

Edited by Drin
Link to comment
Share on other sites

So, PixelChecksum is returning a double !!!

After running the following code :

For $iCnt = 0 To 3

$iChk = PixelChecksum( $PosX[$iCnt], $PosY[$iCnt], $PosX[$iCnt] + 2, $PosY[$iCnt] + 3 )

_Log("PixelCheckSum( " & $PosX[$iCnt] & ", " & $PosY[$iCnt] & ", " & $PosX[$iCnt] + 2 & ", " & $PosY[$iCnt] + 3 & ") " & $iCnt & " : " & _

$iChk & " 0x" & Hex($iChk, 8) & " 0x" & Hex( Int( $iChk ), 8 ) )) & " | " & VarGetType( $iChk ) )

Next

PixelCheckSum( 251, 551, 253, 554) 0 : 717754380 0x2AC8100C 0x2AC8100C | Double

PixelCheckSum( 331, 551, 333, 554) 1 : 4261874088 0x80000000 0xFE0709A8 | Double

PixelCheckSum( 411, 551, 413, 554) 2 : 3449688091 0x80000000 0xCD9E101B | Double

PixelCheckSum( 491, 551, 493, 554) 3 : 2024278997 0x78A80BD5 0x78A80BD5 | Double

Now, the problem seems to be with Hex ( Double, 8 ) ...

Link to comment
Share on other sites

  • Moderators

Drin,

From the Help file:

"Hex : Returns a string representation of an integer or of a binary type converted to hexadecimal."

So it will not return a valid hex number from a Double. :)

Interesting that it returns a Double though - I always thought it returned an Int. :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...