Advertisement
jcunews

HotkeyList.ahk

Dec 5th, 2020 (edited)
3,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;HotkeyList v1.0.1
  2. ;List all hotkeys which were registered using HotKey API.
  3. ;
  4. ;https://pastebin.com/u/jcunews
  5. ;https://greasyfork.org/en/users/85671-jcunews
  6. ;https://www.reddit.com/u/jcunews1
  7.  
  8. keys:= []
  9. loop 16 {
  10.   mod:= a_index - 1
  11.   ms:= ""
  12.   if (mod & 8)
  13.     ms:= ms . "Win + "
  14.   if (mod & 4)
  15.     ms:= ms . "Shift + "
  16.   if (mod & 2)
  17.     ms:= ms . "Ctrl + "
  18.   if (mod & 1)
  19.     ms:= ms . "Alt + "
  20.   loop 255 {
  21.     if (a_index == 0xE7) ;skip Packet VKey. it's used by the system
  22.       continue
  23.     vkey:= a_index
  24.     res:= dllcall("RegisterHotKey", "ptr", 0, "int", 0, "uint", mod, "uint", vkey)
  25.     if (res == 1) {
  26.       dllcall("UnregisterHotKey", "ptr", 0, "int", 0)
  27.     } else {
  28.       v:= format("vk{:02X}", vkey)
  29.       k:= getkeyname(v)
  30.       if (strlen(k) == 1) {
  31.         stringupper s, % k
  32.       } else s:= k
  33.       keys.push(ms . (s != "" ? s : v))
  34.     }
  35.   }
  36. }
  37. if (keys.length()) {
  38.   s:= ""
  39.   loop % keys.length() {
  40.     s:= s . keys[a_index] . "`n"
  41.   }
  42.   filedelete %temp%\keys.txt
  43.   fileappend %s%, %temp%\keys.txt
  44.   run %temp%\keys.txt
  45. } else msgbox No hotkeys registered.
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement