script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
adi
Posts: 15
Joined: 02 Jul 2018, 07:12

script

02 Jul 2018, 07:33

hello this script makes that when we have the mouse 2 pressed and the color changes in the middle of the screen it will automatically launch the mouse button 1

I would like this script to run the mouse 1 only when the color in the middle of the screen changes color to red

Does anyone know how to change this code?



sens:=10
delz:=10
holdtiem:=400
crossset:=1
;color split
SplitRGBColor(RGBColor, ByRef Red, ByRef Green, ByRef Blue)
{
Red := RGBColor >> 16 & 0xFF
Green := RGBColor >> 8 & 0xFF
Blue := RGBColor & 0xFF
}

SplitBGRColor(BGRColor, ByRef Red, ByRef Green, ByRef Blue)
{
Red := BGRColor & 0xFF
Green := BGRColor >> 8 & 0xFF
Blue := BGRColor >> 16 & 0xFF
}

;Menu loop
loop
{
GetKeyState, state, F10
if state = D
{
SoundPlay, %A_ScriptDir%\8.mp3
sleep 2000
ExitApp
}

GetKeyState, state, F11
if state = D
{
trigger:=false
}

GetKeyState, state, Insert
if state = D
{
trigger:=true
}

;Beta trigger
if !GetKeyState("XButton2") && trigger==true
{
sleep 50
MouseGetPos, oneX, oneY
PixelGetColor, colorone, oneX+crossset, oneY+crossset
SplitRGBColor(colorone, oneRed, oneGreen, oneBlue)
}

if GetKeyState("XButton2") && trigger==true
{
sleep 1
MouseGetPos, twoX, twoY
PixelGetColor, colortwo, twoX+crossset, twoY+crossset
SplitRGBColor(colortwo, twoRed, twoGreen, twoBlue)

if (((oneRed-sens)<=twoRed) && ((oneRed+sens)<=twoRed)) or (((oneRed-sens)>=twoRed) && ((oneRed+sens)>=twoRed)) or (((oneGreen-sens)<=twoGreen) && ((oneGreen+sens)<=twoGreen)) or (((oneGreen-sens)>=twoGreen) && ((oneGreen+sens)>=twoGreen)) or (((oneBlue-sens)<=twoBlue) && ((oneBlue+sens)<=twoBlue)) or (((oneBlue-sens)>=twoBlue) && ((oneBlue+sens)>=twoBlue))
{
sleep delz
DllCall("mouse_event", uint, 2, int, 0, int, 0, uint, 0, int, 0)
sleep holdtiem
DllCall("mouse_event", uint, 4, int, 0, int, 0, uint, 0, int, 0)
}
}
}
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: script

06 Jul 2018, 00:43

Please use code-tags and post one or more issues in only one thread. Not the other way :trollface: :trollface:
Double-posting. gähn :crazy:
Einfach nur ein toller Typ. :mrgreen:
imustbeamoron
Posts: 44
Joined: 18 Aug 2016, 22:56

Re: script

06 Jul 2018, 06:29

also, a little more descriptive title would be good.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750 and 229 guests