Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #SingleInstance Force
- physical_hotkey = c
- virtual_hotkey = 0
- loot_hotkey = p
- interval = 29950
- last_use = 0
- cooldown = 15000
- global hotkeys = 0
- global window_bind = null
- !a::
- WinGet, window_bind, ID, A
- hotkeys = 1
- SetTimer, loot, 500
- SetTimer, refresh, 500
- Hotkey,$%physical_hotkey%,intercept
- exit
- !d::
- hotkeys = 0
- SetTimer, loot, off
- SetTimer, refresh, off
- exit
- refresh:
- check_active()
- elapsed := A_TickCount - last_use
- if (elapsed > interval && elapsed > cooldown)
- {
- send %virtual_hotkey%
- last_use := A_TickCount
- }
- exit
- loot:
- check_active()
- if GetKeyState("LButton")
- {
- exit
- }
- send %loot_hotkey%
- exit
- check_active(default =-1)
- {
- WinGet, current, ID, A
- if (current != window_bind or !hotkeys)
- {
- If(default != -1)
- {
- send {%default%}
- }
- exit
- }
- }
- intercept:
- check_active(physical_hotkey)
- elapsed := A_TickCount - last_use
- if (elapsed > cooldown)
- {
- last_use := A_TickCount
- send {%virtual_hotkey%}
- }
- exit
- delay_send(keys, delay)
- {
- Loop, parse, keys
- {
- send %A_LoopField%
- sleep %delay%
- }
- }
- exit
- ^Esc::ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement