lilandywandy Posted August 19, 2005 Share Posted August 19, 2005 I understand something like this: If PixelGetColor(119,780) = Dec("94929c") Then Send("{F7}") Sleep(2000) does a specific action when a pixel equals a specific color But lets say the color for my program is k0k0k0 how can i make it so that my comp just clicks on k0k0k0 when it is present? (the coords are uncertain, it just clicks when ever k0k0k0 is somewhere on screen) Link to comment Share on other sites More sharing options...
LxP Posted August 19, 2005 Share Posted August 19, 2005 hotkeySet("{ESC}", "quit") func quit() exit endFunc local $rgb = 0xc0c0c0 local $xy while (1) $xy = pixelSearch(0, 0, @desktopWidth, @desktopHeight, $rgb) ; if colour is found if not(@error) then mouseClick("primary", $xy[0], $xy[1]) ; wait until colour is gone from that spot while (pixelGetColor($xy[0], $xy[1] = $rgb) sleep(100) wEnd else sleep(1000) endIf wEnd Link to comment Share on other sites More sharing options...
lilandywandy Posted August 19, 2005 Author Share Posted August 19, 2005 mouseClick("primary", $xy[0], $xy[1]) sorry im a beginning, which part do i add "right" for right click? i tested it, it seems to work great, but i havnt run into the error part i was wondering, what happens if that colors not present? does it just sleep till it is? Link to comment Share on other sites More sharing options...
LxP Posted August 19, 2005 Share Posted August 19, 2005 (edited) Simply replace primary with either secondary or right.If the colour's not present then it waits for a full second before checking again. When the colour is present, the script clicks the mouse at that point, waits until the colour is gone and then starts again. Feel free to change the Sleep() values to suit. Edited August 19, 2005 by LxP Link to comment Share on other sites More sharing options...
lilandywandy Posted August 19, 2005 Author Share Posted August 19, 2005 in that case.... this is amazing! XD just what i wanted to make thnx alot Link to comment Share on other sites More sharing options...
lilandywandy Posted August 19, 2005 Author Share Posted August 19, 2005 o damn i found a problem =( there are more then 1 on screen at a time, how can i make it on a random one , (5000) then hit another one? cause right now when there are more then one on screen, it clicks on one of them, and then it stops working after ( even when its still on the screen somewhere else) also, is there anyway i can make it so that, instead of click on the color, it clicks 1/2 inch below the color? Link to comment Share on other sites More sharing options...
lilandywandy Posted August 19, 2005 Author Share Posted August 19, 2005 actually i think it would be a lot easier if the program just keeps clicking and clicking at a random k0k0k0 when its present and just sleeps when not Link to comment Share on other sites More sharing options...
Valuater Posted August 19, 2005 Share Posted August 19, 2005 try this hotkeySet("{ESC}", "quit") func quit() exit endFunc local $rgb = 0xc0c0c0 local $xy while (1) $xy = pixelSearch(0, 0, @desktopWidth, @desktopHeight, $rgb) ; if colour is found if not(@error) then mouseClick("primary", $xy[0], $xy[1] + 20); + 20 for apx 1/2 inch lower ; wait until colour is gone from that spot ;while (pixelGetColor($xy[0], $xy[1] = $rgb); take out while/sleep ; sleep(100) ;wEnd else sleep(5000); changed to 5000 ( 5 seconds) endIf wEnd not tested 8) 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