northlight Posted June 19, 2010 Share Posted June 19, 2010 Ok, so i need some help. I need to figure out how to get this to work If MouseClick("middle") Then ;Step1 Click Middle Mouse Key ; Dim $cordinates = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x2B3033) ;Step 2 Search for pixel ; MouseClick( "left",$cordinates[0],$cordinates[1],1,0) ;Step 3 Found it!! and click once! ; If @error Then EndIf ;Step4 If i didnt find it stop and wait for middle key so if anyone could help me that would be great im really trying here it seems nothing will work. Link to comment Share on other sites More sharing options...
Mat Posted June 19, 2010 Share Posted June 19, 2010 A few things. MouseClick clicks the mouse. You want a function more like _IsPressed(4) or something. EndIf ends a block. So you want ContinueLoop. Try this: #include<Misc.au3> While 1 If _IsPressed(4) Then Local $cordinates = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x2B3033) If @error Then ContinueLoop MouseClick( "left",$cordinates[0],$cordinates[1],1,0) EndIf Sleep(10) WEnd Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
northlight Posted June 19, 2010 Author Share Posted June 19, 2010 (edited) wow i feel stupid i didnt think of that and i had the wrong end statement without realizing it thank you very much EDIT: is there a way to search only around a small radius from the mouse or even more then one color before clicking? Edited June 19, 2010 by northlight Link to comment Share on other sites More sharing options...
Mat Posted June 19, 2010 Share Posted June 19, 2010 (edited) wow i feel stupid i didnt think of that and i had the wrong end statement without realizing it thank you very much EDIT: is there a way to search only around a small radius from the mouse or even more then one color before clicking? Well... Yes it is. MouseGetPos() returns the position of the mouse in the same way as PixelSearch does. If you want an actual radius as in circles... Thats a lot of maths and not advised. You're better off searching a square. Local $iRadius = 50 Local $aMousePos = MouseGetPos() Local $aPixel = PixelSearch($aMousePos[0] - $iRadius, $aMousePos[1] - $iRadius, $aMousePos[0] + $iRadius, $aMousePos[1] + $iRadius, 0x2B3033) More than one is... more than 1 PixelSearch Edited June 19, 2010 by Mat AutoIt Project Listing 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