# 监听指定按键被按下

{$lua}

-- 语法检查时跳过
if syntaxcheck then return end

[ENABLE]
DoneState = false

local htimer = createTimer(getMainForm())
htimer.Interval = 300
htimer.OnTimer =  function(timer)
  if DoneState == true then return htimer.destroy() end

  if isKeyPressed(0x41) then
    showMessage('A')
  end
end
 
[DISABLE]
DoneState = true

# 注册ctrl+a的合键

{$lua}
if syntaxcheck then return end

[ENABLE]
local function funa()
  showMessage('ctrl + A')
end

hk = createHotkey(funa, VK_CONTROL, 0x41)

[DISABLE]
hk.destroy()