major_lee Posted July 3, 2022 Posted July 3, 2022 (edited) versatile and quick method to click on color. pause key pauses and resets color. the color that is mouse when activated is clicked while that color. end quits the script expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.16.0 Author: #IAmMajor Script Function: autoClick while mouse color is on toggle. #ce ---------------------------------------------------------------------------- $color = getColor() $pause = True HotKeySet("{end}", "stop") HotKeySet("{pause}", "pause") Func pause() If ($pause) Then $color = getColor() $pause = False Else $pause = True EndIf EndFunc ;==>pause Func stop() Exit EndFunc ;==>stop Func getColor() Local $aPos = MouseGetPos() Return PixelGetColor($aPos[0], $aPos[1]) EndFunc ;==>getColor While 1 If (Not $pause) Then If (getColor() == $color) Then MouseClick("Primary") Else Sleep(10) EndIf Else Sleep(1000) EndIf WEnd Also an offset version, i know some times color is as the mouse. Subtacting mouse position by defined as offset=5 expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.16.0 Author: #IAmMajor Script Function: autoClick while mouse color is on toggle. #ce ---------------------------------------------------------------------------- $offset = 5 $color = getColor() $pause = True HotKeySet("{end}", "stop") HotKeySet("{pause}", "pause") Func pause() If ($pause) Then $color = getColor() $pause = False Else $pause = True EndIf EndFunc ;==>pause Func stop() Exit EndFunc ;==>stop Func getColor() Local $aPos = MouseGetPos() Return PixelGetColor($aPos[0]-$offset, $aPos[1]-$offset) EndFunc ;==>getColor While 1 If (Not $pause) Then If (getColor() == $color) Then MouseClick("Primary") Else Sleep(10) EndIf Else Sleep(1000) EndIf WEnd Edited July 3, 2022 by major_lee
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