对某软件设置快捷键.ahk 750 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. ; @Author : liuyuqi
  2. ; @Contact : liuyuqi.gov@msn.cn
  3. ; @Time : 2019/08/05 07:06:02
  4. ; @Version : 1.0
  5. ; @License : (C)Copyright 2019 liuyuqi.
  6. ; @Desc : AHK默认全局,可以设置针对某一窗口执行快捷键
  7. ; win+space
  8. #space::
  9. IfWinExist, Untitled - Notepad
  10. WinActivate
  11. else
  12. WinActivate, Calculator
  13. Return
  14. ; ctrl+w
  15. ^w::
  16. if WinActive("ahk_class Notepad") or WinActive("ahk_class" . ClassName)
  17. WinClose
  18. Return
  19. ; ctrl+i
  20. ^i::
  21. IfWinActive, Untitled - Notepad {
  22. WinMaximize
  23. Send, Some text.{Enter}
  24. return
  25. }
  26. Return
  27. #IfWinActive ahk_class Notepad
  28. #z::
  29. #IfWinActive ahk_class WordPadClass
  30. #z::
  31. MsgBox You pressed Win+Z in either Notepad or WordPad.
  32. Return