Code: Select all
--------
-------- Auto Attach to Process
--------
PROCESS_NAME = 'Game.exe'
local autoAttachTimer = nil
local autoAttachTimerInterval = 100
local autoAttachTimerTicks = 0
local autoAttachTimerTickMax = 5000
local function autoAttachTimer_tick(timer)
if getProcessIDFromProcessName(PROCESS_NAME) ~= nil then
timer.destroy()
openProcess(PROCESS_NAME)
elseif autoAttachTimerTickMax > 0 and autoAttachTimerTicks >= autoAttachTimerTickMax then
timer.destroy()
end
autoAttachTimerTicks = autoAttachTimerTicks + 1
end
autoAttachTimer = createTimer(MainForm)
autoAttachTimer.Interval = autoAttachTimerInterval
autoAttachTimer.OnTimer = autoAttachTimer_tick