Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance Force
- #Persistent
- area_count=0
- area_count2=0
- CoordMode, Mouse, Screen
- CoordMode, Pixel, Screen
- ;===Hotkeys=========================================================================
- ^Lbutton:: ;Ctrl+Left click and drag to define search area for the first (left) number 0, credit to Giorgio/Leef_me
- MouseGetPos, MX, MY
- Gui, +AlwaysOnTop -caption +Border +ToolWindow +LastFound
- WinSet, Transparent, 80
- Gui, Color, lime
- While, (GetKeyState("LButton", "p"))
- {
- MouseGetPos, MXend, MYend
- Send {control up}
- w := abs(MX - MXend)
- h := abs(MY - MYend)
- If ( MX < MXend )
- X := MX
- Else
- X := MXend
- If ( MY < MYend )
- Y := MY
- Else
- Y := MYend
- Gui, Show, x%X% y%Y% w%w% h%h%
- Sleep, 10
- }
- MouseGetPos, MXend, MYend
- Gui, Destroy
- If ( MX > MXend )
- {
- temp := MX
- MX := MXend
- MXend := temp
- }
- If ( MY > MYend )
- {
- temp := MY
- MY := MYend
- MYend := temp
- }
- area_count++
- Area%area_count% = %MX%, %MY%, %MXend%, %MYend%
- ;Sleep, 100 ; if omitted, GUI sometimes stays in picture
- Return
- ^Rbutton:: ;Ctrl+Right click and drag to define search area for the second (right) number 0, credit to Giorgio/Leef_me
- MouseGetPos, MX2, MY2
- Gui, +AlwaysOnTop -caption +Border +ToolWindow +LastFound
- WinSet, Transparent, 80
- Gui, Color, blue
- While, (GetKeyState("RButton", "p"))
- {
- MouseGetPos, MXend2, MYend2
- Send {control up}
- w := abs(MX2 - MXend2)
- h := abs(MY2 - MYend2)
- If ( MX2 < MXend2 )
- X := MX2
- Else
- X := MXend2
- If ( MY2 < MYend2 )
- Y := MY2
- Else
- Y := MYend2
- Gui, Show, x%X% y%Y% w%w% h%h%
- Sleep, 10
- }
- MouseGetPos, MXend2, MYend2
- Gui, Destroy
- If ( MX2 > MXend2 )
- {
- temp2 := MX2
- MX2 := MXend2
- MXend2 := temp2
- }
- If ( MY2 > MYend2 )
- {
- temp2 := MY2
- MY2 := MYend2
- MYend2 := temp2
- }
- area_count2++
- Area%area_count2% = %MX2%, %MY2%, %MXend2%, %MYend2%
- ;Sleep, 100 ; if omitted, GUI sometimes stays in picture
- Return
- F11::listvars
- ]:: ;Set Button Location
- MouseGetPos, MXPress, MYPress
- ;MsgBox %MXPress% | %MYPress%
- Return
- ':: ;arm and verify location set properly
- Click %MXPress%, %MYPress%
- ;MsgBox Click! This would click at %MXPress% | %MYPress%
- Return
- [:: ; Initialize Search, click when found
- Loop,
- {
- ImageSearch, , , %MX%, %MY%, %MXend%, %MYend%, *170 Reddit Zero Button.png
- If ErrorLevel = 0
- {
- ImageSearch, , , %MX2%, %MY2%, %MXend2%, %MYend2%, *170 Reddit Zero Button.png
- If ErrorLevel = 0
- {
- Click %MXPress%, %MYPress%
- ;MsgBox Click! This would click the button, did it find the zero, or misfire?
- Suspend
- ExitApp
- }
- }
- }
- Return ;I...don't think this return will ever be reached though
- Escape::
- Suspend
- ExitApp
- ;Made by bloodstar23, selection parts blatantly stolen from http://www.autohotkey.com/board/topic/112071-how-to-select-screen-region-save-coordinate-with-mouse/
Advertisement
Add Comment
Please, Sign In to add comment