Hold the button and click if color changes

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
alexangel
Posts: 1
Joined: 19 Feb 2018, 00:21

Hold the button and click if color changes

19 Feb 2018, 00:27

I want to make a script that works only when i hold mouse3 button and it's click only when color of the button changes. This is my script. I just spend whole night trying to make this work.

Code: Select all

*~MButton::

Loop
{
  MouseGetPos Xpos, Ypos
sleep 100
  while Running
    {
       
        PixelGetColor Colour, %Xpos%, %Ypos%, RGB
        if(Colour == "0x4BDB6A")
        {
            MouseClick, left
        }
    }
  Sleep, 500
}
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Hold the button and click if color changes

19 Feb 2018, 00:49

Code: Select all

#NoEnv
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen

*~MButton::
    Running := 1
    MouseGetPos Xpos, Ypos
    PixelGetColor currColour, Xpos, Ypos, RGB
    sleep 100
    while Running
    {
        PixelGetColor Colour, Xpos, Ypos, RGB
        if(Colour != currColour)
            Click
        Sleep, 500
    }
return
*~MButton Up::Running := 0
HTH

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 295 guests