RichardL Posted November 19, 2016 Share Posted November 19, 2016 The last few times I've used PixelChecksum it often returns 80000000. The last time I used it to watch a progress indicator it gave me this list: 22d25984 12a74f7e 80000000 80000000 80000000 80000000 55375982 80000000 0259f4da 014c2e0d The screen area was about 100*100, using default mode (=ADLER). Windows-7 64. I don't believe one number should occur that often, and seems to me that the calculations have hit most neg 32 bit value and given up? Link to comment Share on other sites More sharing options...
water Posted November 19, 2016 Share Posted November 19, 2016 Can you pleae post the full statement you use? What is the value for "Step"? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
snoopie Posted November 19, 2016 Share Posted November 19, 2016 Have you set this option in your script and if so, to what value? Or try calling the function with a specific window handle. Opt("PixelCoordMode", 1) ;1=absolute, 0=relative, 2=client Link to comment Share on other sites More sharing options...
RichardL Posted November 19, 2016 Author Share Posted November 19, 2016 (edited) Opt("MouseCoordMode", 2) Opt("PixelCoordMode", 2) $sTitle = <window_title> WinActivate($sTitle) Sleep(100) $Pos = WinGetPos("") ... ; Wait for the area to become static. For $iIx = 1 to 10 $lCSum1 = PixelChecksum($Pos[2] * 89/100, $Pos[3] * 86 / 100, $Pos[2] * 99/100, $Pos[3] * 98 / 100) ConFmtWr("CS %8x\n", $lCSum1) Sleep(200) Next The Pos calculations select the bot-right about 100 pix square of a window. I checked the calcs using MouseMove. (I've inserted code don't understand colour scheme.) Edited November 19, 2016 by RichardL oops, deleted the sleep from the loop Link to comment Share on other sites More sharing options...
snoopie Posted November 19, 2016 Share Posted November 19, 2016 You're calling PixelCheckSum() without a window handle, which means the function always scans the currently active client area. If another window becomes active during your loop, where no pixels are changing, you'll see repeated values like 80000000 even though the $sTitle window is still visible. You can do this: Opt("MouseCoordMode", 2) Opt("PixelCoordMode", 2) $sTitle = <window_title> WinActivate($sTitle) $hWin = WinGetHandle($sTitle) Sleep(100) $Pos = WinGetPos("") ... ; Wait for the area to become static. For $iIx = 1 to 10 $lCSum1 = PixelChecksum($Pos[2] * 89/100, $Pos[3] * 86 / 100, $Pos[2] * 99/100, $Pos[3] * 98 / 100, 1, $hWin) ConFmtWr("CS %8x\n", $lCSum1) Sleep(200) Next Link to comment Share on other sites More sharing options...
RichardL Posted November 19, 2016 Author Share Posted November 19, 2016 (edited) I've added in the $hWin, doesn't fix the problem, and I've added a reading and printing the Active window title - it's not changing. I'm going to try to make an independent demo, using notepad. Edited November 19, 2016 by RichardL shameful spelling Link to comment Share on other sites More sharing options...
Bert Posted November 19, 2016 Share Posted November 19, 2016 have to chime in here - I see you used the word "bot" in your post and what you describe can easily be used in a game. Can you tell us please what application this script is being used in please? If a game, understand it is against forum rules to discuss game automation. Thanks. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
RichardL Posted November 19, 2016 Author Share Posted November 19, 2016 The code starts Notepad, repeatedly PixelChecksums the top right, while typing in letters. Now I see that the result from PixelChecksum is alright, but is often too big for the conversion to decimal or hex, so print the value as a string. The equating with previous values seems to work with either = or ==, and in the end the actual value doesn't matter, just whether it matches the previous, or the reference. expandcollapse popupOpt("MouseCoordMode", 2) Opt("PixelCoordMode", 2) Opt("MustDeclareVars", 1) Func ConFmtWr($sCntrl, $a = "", $b = "", $c = "", $d = "", $e = "", $f = "", $g = "", $h = "", $i = "", $j = "", $k = "", $l = "") ConsoleWrite(StringFormat($sCntrl, $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l)) EndFunc ;==>ConFmtWr Local $sTitle Local $Pos Local $lCSum0 Local $lCSum1 Local $iMMode Local $iPMode Local $iIx Local $hWin Local $bDiffN Local $bDiffS ShellExecute("Notepad") $sTitle = "Untitled - Notepad" WinMove($sTitle, "", 600, 100, 400, 400) WinActivate($sTitle) WinWaitActive($sTitle) $hWin = WinGetHandle($sTitle) Sleep(200) MouseMove(0,0, 9) MouseMove(200,100, 9) $lCSum0 = 0 For $iIx = 1 to 20 $lCSum1 = PixelChecksum(0, 0, 200, 100, 1, $hWin) $bDiffN = ($lCSum1 = $lCSum0) $bDiffS = ($lCSum1 == $lCSum0) ConFmtWr("CS %08x %12d %12s %d %d\n", $lCSum1, $lCSum1, $lCSum1, $bDiffN, $bDiffS) $lCSum0 = $lCSum1 If $iIx <> 5 Then Send("A") Sleep(200) Next Send("! Cn") ; close Notepad Link to comment Share on other sites More sharing options...
AndyG Posted November 19, 2016 Share Posted November 19, 2016 Hi, did you read the helpfile about stringformat? Return-type of PixelChecksum() is "double" (have a look into helpfile at VarGetType()-function) , your "type-conversion" via %08x into integer can not work! The same with %12d, which is SIGNED integer also...you need an integer unsigned... $lCSum1 = PixelChecksum(0, 0, 200, 100, 1, $hWin) $lCSum1 = Int($lCSum1) ConFmtWr("CS %08x %12u %12s %d %d\n", $lCSum1, $lCSum1, $lCSum1, $bDiffN, $bDiffS) converts the double to integer, shows the Checksum in hex-view, unsigned integer and string....works now :o) Link to comment Share on other sites More sharing options...
RichardL Posted November 19, 2016 Author Share Posted November 19, 2016 Yes, I looked at the help on datatypes, StringFormat and I tried %u. It will give better pos range, less neg, and didn't fix it for the values I was getting. Double is I think 64 bit float with 52 bits of fraction and it looks like the limit of integer conversion in StringFormat is 32. Anyway, detecting change works well, I should take care not to lose data by converting. Link to comment Share on other sites More sharing options...
Bert Posted November 20, 2016 Share Posted November 20, 2016 (edited) with your skill and the fact your using notepad - I'm stunned at why you are not reading the control - which is really what notepad really is. So, is there some reason why you are not reading notepad in by reading the control and getting the text entered? Also - why move the mouse? I'm reporting this thread to a moderator and have them chime in. Edited November 20, 2016 by Bert The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
aa2zz6 Posted November 20, 2016 Share Posted November 20, 2016 8 hours ago, Bert said: have to chime in here - I see you used the word "bot" in your post and what you describe can easily be used in a game. Can you tell us please what application this script is being used in please? If a game, understand it is against forum rules to discuss game automation. Thanks. Perhaps bot-right refers to bottom-right, but wrote short handed. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 20, 2016 Moderators Share Posted November 20, 2016 Hi, Quote I see you used the word "bot" in your post and what you describe can easily be used in a game I see no prima facie evidence from the OP's posts in this thread to indicate that the code is destined for a game-bot - and as mere suspicion will never be a valid reason to act, I am leaving it open. 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...
RichardL Posted November 20, 2016 Author Share Posted November 20, 2016 Notepad was just to repeat the issue without the industrial software that I'm automating. I have looked at it with Window-Info, there's nothing available. Sorry for abbreviation causing rule-breach false alarm. Link to comment Share on other sites More sharing options...
AndyG Posted November 20, 2016 Share Posted November 20, 2016 41 minutes ago, RichardL said: just to repeat the issue without the industrial software that I'm automating. Automating "Industrial Software" is usually an adventure... Even if the Window-Info-Tool detect a "Handle/Control" it must not be, that this "Control" can/could be "controlled" by the AutoIt-Control-Commands. For example, i got some controls which included date/time. There was no possibility to "send" some data to those controls, the only way to automate the Software was to "click" into the control to activate the cursor, "step" to the end via sending an "end", delete the content with some "backspace"s and send the required numbers and a colon to "write" the needed time/date. Not to mention those Windows which have not the focus after they appear, and/or at the worst, not to catch with the Window-control-functions.... Usually, several routes lead to rome Link to comment Share on other sites More sharing options...
Bert Posted November 21, 2016 Share Posted November 21, 2016 16 hours ago, RichardL said: Notepad was just to repeat the issue without the industrial software that I'm automating. I have looked at it with Window-Info, there's nothing available. Sorry for abbreviation causing rule-breach false alarm. Sorry for my earlier post. I do have something that may help. Take a look at this: https://www.autoitscript.com/forum/topic/153520-iuiautomation-ms-framework-automate-chrome-ff-ie/ It should allow for you to hook into those controls that are giving you trouble and make your script much more stable. The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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