Drin Posted August 12, 2011 Share Posted August 12, 2011 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 ) )NextThe result is below :PixelCheckSum( 251, 551, 253, 554) 0 : 717754380 0x2AC8100C 0x2AC8100CPixelCheckSum( 331, 551, 333, 554) 1 : 4261874088 0x80000000 0xFE0709A8PixelCheckSum( 411, 551, 413, 554) 2 : 3449688091 0x80000000 0xCD9E101BPixelCheckSum( 491, 551, 493, 554) 3 : 2024278997 0x78A80BD5 0x78A80BD5Why Hex( 3449688091, 8 ) = 0x80000000 but Hex ( Int( 3449688091 ) , 8 ) = 0xFE0709A8 ?What is the return type of PixelChecksum ? Link to comment Share on other sites More sharing options...
JohnOne Posted August 12, 2011 Share Posted August 12, 2011 $iChk = PixelChecksum( $PosX[$iCnt], $PosY[$iCnt], $PosX[$iCnt] + 2, $PosY[$iCnt] + 3 ) MsgBox(0,"Result",VarGetType($iChk)) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 12, 2011 Moderators Share Posted August 12, 2011 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. 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Drin Posted August 15, 2011 Author Share Posted August 15, 2011 (edited) 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 August 15, 2011 by Drin Link to comment Share on other sites More sharing options...
Drin Posted August 15, 2011 Author Share Posted August 15, 2011 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 ) )NextPixelCheckSum( 251, 551, 253, 554) 0 : 717754380 0x2AC8100C 0x2AC8100C | DoublePixelCheckSum( 331, 551, 333, 554) 1 : 4261874088 0x80000000 0xFE0709A8 | DoublePixelCheckSum( 411, 551, 413, 554) 2 : 3449688091 0x80000000 0xCD9E101B | DoublePixelCheckSum( 491, 551, 493, 554) 3 : 2024278997 0x78A80BD5 0x78A80BD5 | DoubleNow, the problem seems to be with Hex ( Double, 8 ) ... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 15, 2011 Moderators Share Posted August 15, 2011 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. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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