I thought this would be easy but I'm having trouble with it, and keep getting the same color spammed despite a few different ways of trying. My current code:
Code: Select all
#NoEnv
#SingleInstance, Force
SetWorkingDir %A_ScriptDir%
SetTimer, mouseTrack, 20
mouseTrack:
MouseGetPos, vCurX, vCurY
Return
!#RButton::
colorScan := "Start"
errCount = 0
newColor1 := "", newColor2 := "", newColor3 := ""
originX := vCurX, originY := vCurY
SetTimer, WhileHolding, 20
PixelGetColor, originColor, originX, originY, RGB
Return
WhileHolding:
PixelGetColor, newColor, vCurX, vCurY, RGB
While (newColor != originColor) {
If (colorScan = "Done")
Break
++errCount
If (errCount > 5) {
errCount = 0
If ((newColor2 != "") && (newColor3 != newColor2)) {
newColor3 := newColor
colorScan := "Done"
} Else If (!(newColor2 != "") && (newColor2 != newColor1)) {
newColor2 := newColor
} Else {
newColor1 := newColor
}
}
}
ToolTip % errCount "`r`n" originColor "`r`n" newColor "`r`n" "1:" newColor1 "`r`n" "2:" newColor2 "`r`n" "3:" newColor3 "`r`n" colorScan
Return
!#RButton Up::
SetTimer, WhileHolding, Off
ToolTip
Return
I'm trying to store up to 3 color values when I click-drag over them excluding the background color, can this be better done?