Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; color clicker - select point on screen which will be clicked once it becomes the color it was when
- ; you selected it
- ;global Points := Object()
- ResetPoints()
- F9::AddCurrentPoint(Points)
- F10::ResetPoints()
- F11::Run()
- ResetPoints() {
- global Points := Object()
- #Persistent
- ToolTip, "All points reset"
- SetTimer, RemoveToolTip, 1000
- }
- AddPoint(arr, x, y, col) {
- tt := Object()
- tt.Push(x, y, col)
- arr.Push(tt)
- }
- AddCurrentPoint(ar) {
- MouseGetPos, MouseX, MouseY
- PixelGetColor, col, MouseX, MouseY
- AddPoint(ar, MouseX, MouseY, col)
- tt := ar.Length()
- #Persistent
- ToolTip, %tt% %MouseX% %MouseY% %col%
- SetTimer, RemoveToolTip, 1000
- }
- CheckPoint(ar, i) {
- ; CheckPoint(ar, ar.Length())
- x := ar[i, 1]
- y := ar[i, 2]
- col := ar[i, 3]
- PixelGetColor, newcol, x, y
- return (newcol == col)
- }
- ProcessAllPoints(ar) {
- i := 1
- #Persistent
- t := ar.Length()
- ;ToolTip, %t%
- ;SetTimer, RemoveToolTip, 500
- loop %t% {
- GetKeyState, RB, RButton
- GetKeyState, LB, LButton
- if CheckPoint(ar, i) {
- ToolTip, Ready %i%
- SetTimer, RemoveToolTip, 500
- if (RB <> "D") and (LB <> "D") {
- MouseGetPos, OutputVarX, OutputVarY, OutputVarWin
- MouseClick, left, ar[i, 1], ar[i, 2], 2, 0
- MouseMove, OutputVarX, OutputVarY, 0
- Sleep, 200
- }
- }
- i := i + 1
- }
- }
- RemoveToolTip() {
- SetTimer, RemoveToolTip, Off
- ToolTip
- }
- Run(Interval=1000){
- global Points
- static Toggler
- Toggler := !Toggler
- TPer := Toggler ? Interval : "off"
- SetTimer, ClickClick, %TPer%
- ;ToolTip, Multiline`nTooltip, 0, 0
- ; To have a ToolTip disappear after a certain amount of time
- ; without having to use Sleep (which stops the current thread):
- #Persistent
- ToolTip, %OutputVarX% %OutputVarY% %LB% %RB% Toggler: %Toggler%
- SetTimer, RemoveToolTip, 1000
- return
- ClickClick:
- ProcessAllPoints(Points)
- Sleep, 100
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment