BlasphM Posted July 21, 2008 Posted July 21, 2008 Hi everyone, I have a small problem, i'm trying to make a quick macro to actually just click on something coloured, then sleeping, and try to click on the same color somewhere else. Here's my try: $mob = "0x8D7A6B"; Je déclare la couleur de mon mob - That's the colour i'd like to clik $pixelSearch=PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$mob);Je recherche la couleur sur l'écran (size desktop) - searching for the pixel, desktop size 1680x1050 If IsArray($pixelSearch)=1 Then;Si la couleur à été trouvé, then - if the colour have been found, then MouseClick("left",$pixelSearch[200],$pixelSearch[1],1,0);Je click gauche sur le pixel trouvé, position éxacte - then left click on the pixel found Sleep 1000 EndIf Well when i try this, it launch, but nothing happens and it stops, i think i have to make this looping, and then see what's happening IG, any clues of how could i do that? Every advice would be helpfull, thanks!
JFee Posted July 21, 2008 Posted July 21, 2008 Shouldn't the code read: MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,0) Were you getting a subscript error? Regards,Josh
duckling78 Posted July 21, 2008 Posted July 21, 2008 Maybe this will work for you? HotKeySet("{Esc}", "ExitScript") $mob = 0x8D7A6B While 1 $pixelSearch=PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$mob) If IsArray($pixelSearch) Then MouseClick("primary", $pixelSearch[0], $pixelSearch[1], 1, 0) Else ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & ": " & "Color 0x" & Hex($mob) & " was not found." & @CRLF) EndIf Sleep(1000) WEnd Func ExitScript() Exit EndFunc
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