Okay here is something basic I banged out just to get the form and layout of what I wanted to do. This is not meant for DF yet, no checking for client open, active window, etc. I am not at home right now so like I said, I'm just testing it with Explorer windows and moving files from one folder to another. I made the window sizes roughly that of the bags in DF and it seems to be going pretty quick. Moved 4 items all the way across the screen in 3.2 seconds.
Am I on the right track with this? It seems fairly trivial and I'm surprised I haven't seen something similar around here yet, unless its buried somewhere.
Code: Register to unlock hidden link
; CONSTANTS
HotKeySet("{F2}", "DoLoot")
HotKeySet("{DEL}", "Terminate")
$BGCOLOR = 16777215
; CONFIG
; loot top left
MsgBox( 0, "Alert", "Click OK and then hover over your the top left of loot bag." )
Sleep( 3000 )
$MousePos = MouseGetPos( )
$top = $MousePos[1]
$left = $MousePos[0]
; loot bottom right
MsgBox( 0, "Alert", "Click OK and then hover over your the bottom right of loot bag." )
Sleep( 3000 )
$MousePos = MouseGetPos( )
$bottom = $MousePos[1]
$right = $MousePos[0]
; drop location
MsgBox( 0, "Alert", "Click OK and then hover over your drop spot." )
Sleep( 3000 )
$MousePos = MouseGetPos( )
$dropy = $MousePos[1]
$dropx = $MousePos[0]
MsgBox( 0, "Alert", "Okay coordinates configured. Press F2 to loot, DEL to end script." )
; IDLE LOOP
While 1
Sleep(300)
WEnd
; FUNCTIONS
; kill script
Func Terminate()
MsgBox( 0, "Alert", "Ending Script." )
Exit
EndFunc
; scan area and move loot items
Func DoLoot( )
$moved = 0
$start = TimerInit()
For $y = $top To $bottom Step +2
For $x = $left To $right Step +2
$col = PixelGetColor($x, $y)
If $col <> $BGCOLOR Then
MoveItem($x, $y, $dropx, $dropy)
$moved += 1
Sleep(50)
EndIf
Next
Next
$time = TimerDiff($start)
MsgBox(0, "Msg", "Moved " & $moved & " items in " & $time & " ms")
EndFunc
; simple wrapper for MouseClickDrag
Func MoveItem($fromx, $fromy, $tox, $toy)
MouseClickDrag("left", $fromx, $fromy, $tox, $toy, 1)
EndFunc