BatMan22 Posted September 11, 2017 Share Posted September 11, 2017 I am attempting to find the first empty cell in a window that is excel-ish... Unfortunately the copy command, is useless and windowinfo give me no text info at all because the program was probably written in the 1800's. So I am attempting to check ~2 characters worth of pixels for writing, the writing will either be pink or blue. So what I am looking for is a program that will do something like this: Check pixels 50,156 to 65,156 if color is never pink or blue then line is empty and success, otherwise "down key" (moves to the next line without changing co-ordinates because I made the window very thin) and search those coordinates again.. I attached a picture of the window. This is what I have: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Date.au3> #include <File.au3> $sParentWindowTitle = "Queue Editor" If WinActivate($sParentWindowTitle) Then ResizeWindow() Else MsgBox(0,"","Open Queue Editor!") Break EndIf Func ResizeWindow() ; Move the Notepad to the x, y position of 0, 0 and set the height and width at 1491, 195. WinMove($sParentWindowTitle, "", 0, 0, 1491, 195) FindFirstLine() Sleep(1000) ;MoveBack() EndFunc Func FindFirstLine() $pixleft=50 $pixtop=156 Opt("MouseCoordMode", 0) MouseMove($pixleft , $pixtop) Opt("PixelCoordMode", 0) $CopyColor=PixelGetColor ($pixleft , $pixtop) If $CopyColor = 0xFF00FF Then Send("{Down}") & $pixleft=50 & FindFirstLine(); if pink then restart If $CopyColor = 0x0000FF Then Send("{Down}") & $pixleft=50 & FindFirstLine(); if blue then restart $pixleft+= 1 If $pixleft=65 then MsgBox(0,"","Success! ThisBoxIsBlank"); if I made it to pixelleft = 65 without restarting then the line must be clear EndFunc Func MoveBack() WinMove($sParentWindowTitle, "", 178, 219, 1267, 652) EndFunc Link to comment Share on other sites More sharing options...
alienclone Posted September 12, 2017 Share Posted September 12, 2017 there may be a ControlID that the window info tool is not showing. try these additional control info sniffer tools... https://www.autoitscript.com/forum/topic/164226-get-all-windows-controls/ https://www.autoitscript.com/forum/topic/126716-control-viewer-autoit-window-info-tool/ or try the IUIAutomation udf created by junkew https://www.autoitscript.com/forum/topic/153520-iuiautomation-ms-framework-automate-chrome-ff-ie/ If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
BatMan22 Posted September 12, 2017 Author Share Posted September 12, 2017 HAH! I got it working! I'm a GENIUS! I'm sure I can blend those two searches (one for pink then blue) into one search, but... for now it works, I tried a "OR" statement, but that didn't work. Is there a way to do something like.. Local $aCoord = PixelSearch(50, 156, 70, 157, 0xFF00FF OR 0x0000FF) to search for both pink OR blue at the same time? expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Date.au3> #include <File.au3> $sParentWindowTitle = "Queue Editor" If WinActivate($sParentWindowTitle) Then ResizeWindow() Else MsgBox(0,"","Open Queue Editor!") Break EndIf Func ResizeWindow() ; Move the Notepad to the x, y position of 0, 0 and set the height and width at 1491, 195. WinMove($sParentWindowTitle, "", 0, 0, 1491, 195) Sleep(500);pause so screen can refresh BoxSearch() Sleep(1000) MoveBack() EndFunc Func MoveBack() WinMove($sParentWindowTitle, "", 178, 219, 1267, 652) EndFunc Func BoxSearch() Opt("PixelCoordMode", 0) Local $aCoord = PixelSearch(50, 156, 70, 157, 0xFF00FF) ; search for pink If not @error Then Send("{Down}") BoxSearch() EndIf SearchBlue() EndFunc Func SearchBlue() Opt("PixelCoordMode", 0) Local $aCoord = PixelSearch(50, 156, 70, 157, 0x0000FF) ; search for blue If not @error Then Send("{Down}") BoxSearch() EndIf EndFunc Link to comment Share on other sites More sharing options...
BatMan22 Posted September 12, 2017 Author Share Posted September 12, 2017 24 minutes ago, alienclone said: there may be a ControlID that the window info tool is not showing. try these additional control info sniffer tools... https://www.autoitscript.com/forum/topic/164226-get-all-windows-controls/ https://www.autoitscript.com/forum/topic/126716-control-viewer-autoit-window-info-tool/ or try the IUIAutomation udf created by junkew https://www.autoitscript.com/forum/topic/153520-iuiautomation-ms-framework-automate-chrome-ff-ie/ Alien I appreciate your help but that stuff is currently over my head and this IS ghetto, but it works for now Either way I appreciate your response! 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