Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- CoordMode, Mouse, Screen
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #SingleInstance force
- #Persistent
- 1::
- LetUserSelectRect(x1, y1, x2, y2)
- Return
- 2::
- LetUserSelectRect(xx1, yy1, xx2, yy2)
- Return
- 3::
- LetUserSelectRect(xxx1, yyy1, xxx2, yyy2)
- Return
- 6:: ExitApp
- 4::
- Impling:
- Loop {
- CoordMode, Pixel
- PixelSearch, FoundX, FoundY, %x1%, %y1%, %x2%, %y2%, 0x772F29, *15, Fast RGB
- If (ErrorLevel) = 0 {
- MouseClick, Left, %FoundX%, %FoundY%
- gosub, Inventory
- if (ErrorLevel)
- gosub Impling
- }
- }
- Inventory:
- Loop {
- CoordMode, Pixel
- PixelSearch, FoundXX, FoundYY, %xx1%, %yy1%, %xx2%, %yy2%, 0x443C32, *5, Fast RGB
- If (ErrorLevel) = 0
- gosub, Banker
- if (ErrorLevel)
- gosub Impling
- }
- Banker:
- Loop {
- CoordMode, Pixel
- PixelSearch, FoundXXX, FoundYYY, %xxx1%, %yyy1%, %xxx2%, %yyy2%, 0x89807F, *15, Fast RGB
- If (ErrorLevel) = 0
- MouseClick, Right, %FoundXXX%, %FoundYYY%
- gosub, Impling
- }
- 5:: Pause
- Return
- LetUserSelectRect(ByRef X1, ByRef Y1, ByRef X2, ByRef Y2)
- {
- static r := 3
- Loop 4 {
- Gui, %A_Index%: -Caption +ToolWindow +AlwaysOnTop
- Gui, %A_Index%: Color, Red
- }
- Hotkey, *LButton, lusr_return, On
- KeyWait, LButton, D
- MouseGetPos, xorigin, yorigin
- SetTimer, lusr_update, 10
- KeyWait, LButton
- Hotkey, *LButton, Off
- SetTimer, lusr_update, Off
- Loop 4
- Gui, %A_Index%: Destroy
- return
- lusr_update:
- MouseGetPos, x, y
- if (x = xlast && y = ylast)
- ;
- return
- if (x < xorigin)
- x1 := x, x2 := xorigin
- else x2 := x, x1 := xorigin
- if (y < yorigin)
- y1 := y, y2 := yorigin
- else y2 := y, y1 := yorigin
- ;
- Gui, 1:Show, % "NA X" x1 " Y" y1 " W" x2-x1 " H" r
- Gui, 2:Show, % "NA X" x1 " Y" y2-r " W" x2-x1 " H" r
- Gui, 3:Show, % "NA X" x1 " Y" y1 " W" r " H" y2-y1
- Gui, 4:Show, % "NA X" x2-r " Y" y1 " W" r " H" y2-y1
- lusr_return:
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement