xineur / blog

7 stars 0 forks source link

AutoHotkey+electron常用键禁止 #9

Open xineur opened 5 years ago

xineur commented 5 years ago

功能模块

// AutoHotkey.ark
LWin::return
RWin::return
Alt::return
!Tab::return
!F4::return
^Esc::return
^!Left::return
^!right::return
^!up::return
^!down::return
!left::return
!right::return
^Tab::return

常用符号及描述总结

符号 描述
! Alt
# windows
^ Ctrl
+ shift

工具

下载 文档

打包

安装好AutoHotkey后右键选择Compile Script 编译为exe

使用

const { exec } = require('child_process')
let flag = true // 是否开启禁止热键功能
let fileName = 'stopkey.exe' // ahk打包完成后exe名
if (flag) {
  exec(`TASKKILL /F /IM ${fileName}`)
  setTimeout(m => {
    exec(`${__static}\\exe\\${fileName}`) // 运行exe '${__static}\\exe'为ahk exe存放路径
  }, 1000)
} else {
  exec(`TASKKILL /F /IM ${fileName}`)
}