It's all fluff, all the way down ...

Auto Loot in Guild Wars 2 with AutoHotkey

This post was automagically converted from Blogger. There may be dragons. Check any code you copy.

This really simple AutoHotkey script will send simulated presses of F12 to Guild Wars 2 every 250ms. That is it. The range on the AOE-loot does seem to be longer than the standard loot so you should not miss anything. If you still do, lower the number on the SetTimer-row below. I have not tested it below 250 (that is 4 times every second) but it is probably fine down to 100ms or so.

For the example below to work you must set your AOE-loot key to F12 (and unbind it from logout).
Do this before you start the script.

You could of course use another keybinding that does not interfere with anything already bound. Like ctrl+alt+shift+win+f12 which should be fine.

That combination would be ^!+#{F12} in ahk.

You also need to install AutoHotkey… obviously. :)

Copy the code below and save it as an .ahk file, double click it and you’re all set.

Update: Added check to see if Shift is pressed and if so does not send hotkey as not to interfere with chat input.
I could’ve sworn this was working correctly without this previously but eh, now it’s fixed either way.

Update: Added more modifier-key-down-checks as suggested by Namaless.

#SingleInstance force
#Persistent
#NoEnv

SetTimer, lootStuff, 500
return

lootStuff:
  IfWinActive ahk\_class ArenaNet\_Dx\_Window\_Class 
  {
    shiftKey := GetKeyState("Shift", "P")
    altKey := GetKeyState("Alt", "P")
    controlKey := GetKeyState("Control", "P")
    winKey := GetKeyState("LWin", "P")
 
    if !shiftKey and !altKey and !controlKey and !winKey
      SendInput {F12}
  }
return