LmdL123 Posted December 18, 2007 Share Posted December 18, 2007 Hello, Can you help me with some part of my script? I have small window of some program. Let's say 600x400 pixels. This is a Flash program. All the problem is that in this program all the background is one color and its a small square there, about 25x25 pixels and different color from background, that is moving all the time in that area. My problem is how to manage my script to move mouse cursor so it will click on that background all the time in different places until it finnaly clicks on this small square. I think I need to use PixelGetColor (x,y), but how do I use it in this case? It's small square and it moves along big window in different ways and I need to "catch" this square as fast as possible. Any suggestions will be helpful. Post! Link to comment Share on other sites More sharing options...
weaponx Posted December 18, 2007 Share Posted December 18, 2007 You don't need to click more than once. This is literally like 2 lines of code. PixelSearch(): Find the X,Y location of a hex color MouseClick(): Click at previously found X,Y Link to comment Share on other sites More sharing options...
LmdL123 Posted December 18, 2007 Author Share Posted December 18, 2007 Wow! Thanks a lot!!! Link to comment Share on other sites More sharing options...
LmdL123 Posted December 18, 2007 Author Share Posted December 18, 2007 Hmm...Can somebody help me with script? I don't need something very hard to do. That's all:1. I need that Autoit scan this Flash-program and find blue "square" (Red arrow points to this square). (Coordinates of window of Flash-program are: 250x185; 930x185; 250x420; 930x420)2. Left-mouse click on "square".3. Left-mouse click on point(coordinates 270x150)4. Waiting for a 60 seconds.5. Left-mouse click on point(coordinates 620x330).6. And all from the beginning, finds "square" (it already appears in the different place), clicks on it, .....Thanks again for you help!!! Link to comment Share on other sites More sharing options...
LmdL123 Posted December 18, 2007 Author Share Posted December 18, 2007 (edited) I got mistake in my script. Can anybody tell me what is wrong? For $i = 500000 to 1 Step -1 $coord = PixelSearch ( 250, 185, 420, 930, 0x00FFFF,100 ) If Not @error Then MouseClick( "left" [[[,$coord[0] ,$coord[1]] ,1],10] ) MouseClick( "left" [[[,270 ,180] ,1],10] ) Sleep(60000) MouseClick( "left" [[[,620 ,350] ,1],10] ) EndIf Next MsgBox(0,"", "Time Out") Thanks. Edited December 18, 2007 by LmdL123 Link to comment Share on other sites More sharing options...
BrettF Posted December 18, 2007 Share Posted December 18, 2007 (edited) Ok... Read it carefully. Get rid of the '[' and ']'. They are used in arrays only to my memory... EDIT: Should end up like: For $i = 500000 to 1 Step -1 $coord = PixelSearch ( 250, 185, 420, 930, 0x00FFFF,100 ) If Not @error Then MouseClick( "left" ,$coord[0] ,$coord[1] ,1,10) MouseClick( "button" ,270 ,180,1,1) Sleep(60000) MouseClick( "button" ,620 ,350 ,1,10 ) EndIf Next MsgBox(0,"", "Time Out") I also changed the If @error == 0 Then to If Not @error, as it works better... Edited December 18, 2007 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
LmdL123 Posted December 18, 2007 Author Share Posted December 18, 2007 One more problem =) It didn't finds the "square". What color should I enter? I tried aqua (#00FFFF), DarkTurquoise (#00CED1), DeepSkyBlue (#00BFFF)..... Link to comment Share on other sites More sharing options...
weaponx Posted December 18, 2007 Share Posted December 18, 2007 You need to use the AutoIt Window Info tool to get the EXACT color of the square. Its on your start menu. Just run it and place the mouse over the square to get the hex code. 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