litlmike Posted March 28, 2006 Share Posted March 28, 2006 (edited) Whenever the color 0xFF0000 (red) appears in the rectangle (930, 725, 761, 1023), I want a MsgBox to appear and say "Yes!". I would like this to occur everytime 0xFF0000 appears in the rectangle. How do I do it? I was wrong, but I thought this might work: ;*****EDIT***** FIXED Co-Ordinates********* While 1 $coord = PixelSearch ( 930, 725, 1023, 761, 0xFF0000 ) If $coord = 1 Then MsgBox(4096, "Yes!", "Yes!") EndIf WEnd Edited March 28, 2006 by litlmike _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 28, 2006 Moderators Share Posted March 28, 2006 Opt('PixelCoordMode', 2); may need to change the 2 to 1 or 0 depending on what your using to get your coords (screen/windows/client) While 1 If Not WinActive('Window Title To Search') Then WinActivate('Window Title To Search') $coord = PixelSearch ( 930, 725, 761, 1023, 0xFF0000 ) If Not @error And IsArray($coord) Then MsgBox(4096, "Yes!", 'Found at: X coord: ' $coord[0] & ' Y coord: ' & $coord[1]) EndIf WEnd Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 28, 2006 Moderators Share Posted March 28, 2006 Your rectangle coordinates are incorrect... they should be...left,top,right,bottom...yours appear to be...right,top,left,bottomLar.Hmm, I didn't even check that..., I didn't know he was having a prob with them specifically, I just thought it was a general question Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
litlmike Posted March 28, 2006 Author Share Posted March 28, 2006 Hmm, I didn't even check that..., I didn't know he was having a prob with them specifically, I just thought it was a general question Actually it was a general question, but I think he was right too, my coords are off. In general, how should I approach this? _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
litlmike Posted March 28, 2006 Author Share Posted March 28, 2006 perhaps... While 1 $coord = PixelSearch ( 761, 725, 930, 1023, 0xFF0000 ) If Not @error Then MsgBox(4096, "Yes!", "Yes!") Sleep(10) WEnd or maybe you meant by the systray clock... While 1 $coord = PixelSearch ( 725, 930, 761, 1023, 0xFF0000 ) If Not @error Then MsgBox(4096, "Yes!", "Yes!") Sleep(10) WEnd edit: added CPU cycle saving Sleep()Hmm... didn't seem to do it. Any other ideas? _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 28, 2006 Moderators Share Posted March 28, 2006 PixelCoordMode? ... Window Is Active? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Evil_Has_Survived Posted March 28, 2006 Share Posted March 28, 2006 sorry for posting this here, but you guys seem good with pixels maybe you can help, If you don't mind.My Webpage Thanks in advance Link to comment Share on other sites More sharing options...
litlmike Posted March 28, 2006 Author Share Posted March 28, 2006 this works on my systray... you need to make sure you have the correct color value... use the window info tool... $LarrysSysTrayPixel = 0xA9BD31 Opt("WinTitleMatchMode",4) $systray_rect = WinGetPos("classname=Shell_TrayWnd") While 1 $coord = PixelSearch ( $systray_rect[2] - 240, $systray_rect[1], _ $systray_rect[2], $systray_rect[1] + $systray_rect[3], $LarrysSysTrayPixel ) If Not @error Then MsgBox(4096, "Yes!", "Yes!") Sleep(10) WEndNice! It works. I am glad you showed me "classname=Shell_TrayWnd", I haven't used that before, and I think that will help me on some other problems I have. Also, no one has been able to explain this to me yet (so I can understand it). But the [2], [1], stuff, what is that? And, how do you know to use it in this case? Thanks a lot everyone! _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 28, 2006 Moderators Share Posted March 28, 2006 (edited) [2],[1] Dim $MyArray[2] << Allows 2 elements in an array... those would be [0] and [1], and must use Local/Dim/Global (one of those) to declare it. So... I could have $MyArray[0] = 'I am going to ' $MyArray[1] = 'Laugh Out Loud' Then I can check my array like: Dim $MyArray[2] $MyArray[0] = 'I am going to ' $MyArray[1] = 'Laugh Out Loud' For $i = 0 To Ubound($MyArray) - 1 MsgBox(0, '$i = ' & $i, $MyArray[$i]) Next Edit: I guess it's like being able to have one variable with multiple values, but still have an independence, if you want to look at it like that. Edited March 28, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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