It will click on the respective resource icons when they appear and can be deactivated by pressing the last-pressed hotkey once again to toggle back. Keep in mind that only one resource at a time will be gathered - the threads don't stack for some reason.
Controls:
People with qwerty keyboards might want to change the y to z, but as it is I will enforce my German layout with an iron fist.
#IfWinActive, AutoCollectings.ahk SendMode Input SetDefaultMouseSpeed, 0 #MaxThreadsPerHotkey 3 ^+s:: ;Auto-Gather Slate #MaxThreadsPerHotkey 1 WinGetPos,,, wWidth, wHeight SmallIconX1 := wWidth - 137 SmallIconX2 := wWidth - 31 if KeepRunning { KeepRunning := false return } KeepRunning := true loop { PixelSearch, mx, my, %SmallIconX1%, 63, %SmallIconX2%, 63, 0x0066BC, 10 if ErrorLevel = 0 { MouseGetPos, mosx, mosy Click, %mx%, %my% MouseMove, mosx, mosy sleep 100 } if not KeepRunning break } KeepRunning := false return #MaxThreadsPerHotkey 3 ^+y:: ;Auto-Gather Grass #MaxThreadsPerHotkey 1 WinGetPos,,, wWidth, wHeight SmallIconX1 := wWidth - 46 SmallIconX2 := wWidth - 44 if KeepRunning { KeepRunning := false return } KeepRunning := true loop { PixelSearch, mx, my, %SmallIconX1%, 52, %SmallIconX2%, 52, 0xEB332F, 10 if ErrorLevel = 0 { MouseGetPos, mosx, mosy Click, %mx%, %my% MouseMove, mosx, mosy sleep 500 } if not KeepRunning break } KeepRunning := false return #MaxThreadsPerHotkey 3 ^+x:: ;Auto-Gather Clay #MaxThreadsPerHotkey 1 WinGetPos,,, wWidth, wHeight SmallIconX := wWidth - 42 if KeepRunning { KeepRunning := false return } KeepRunning := true loop { PixelSearch, mx, my, %SmallIconX%, 52, %SmallIconX%, 52, 0x322DD4, 10 if ErrorLevel = 0 { MouseGetPos, mosx, mosy Click, %mx%, %my% MouseMove, mosx, mosy sleep 500 } if not KeepRunning break } KeepRunning := false return