Reading All Short Keys in File

Get help with using AutoHotkey and its commands and hotkeys
Posts: 5
Joined: 22 Jun 2016, 04:25

Reading All Short Keys in File

13 Jul 2018, 08:15

I was wondering if there was some sort of way to return all the shortcuts from an AHK macro file?

I have an AHK file which is full of shortcuts and I am always adding to it.

They are either in the format of Alt + Something or plain text replacement (usually along the lines of ASTERISK + email = replaced with "")

I was trying to think of ways to do this and thought of 2 options:

1: (a long shot) A way to read all the shortcut keys (maybe built in) and return them in msgbox, or in a variable for use elsewhere
2: (more likely) Apply a particular comment text (maybe duplicate semi colons) above each shortcut that can be looped through and read

;;Alt + P = Send printer path
send, \\printerpathexample\example\example1printer

Are either of these options possible? Maybe by using FILEREADLINE and some sort of loop?
User avatar
Posts: 1131
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Reading All Short Keys in File

13 Jul 2018, 08:56

You can double-click the AutoHotkey tray icon, and then after the window opens press Ctrl + H or just click menu View > Hotkeys and their methods.

Also, courtesy of Lexikos:

Code: Select all

#SingleInstance, Force #InstallKeybdHook MsgBox, % ScriptInfo("ListHotkeys") !p::Send, \\printerpathexample\example\example1printer F1 & F2::MsgBox, Test ScriptInfo(Command) { static hEdit := 0, pfn, bkp if !hEdit { hEdit := DllCall("GetWindow", "ptr", A_ScriptHwnd, "uint", 5, "ptr") user32 := DllCall("GetModuleHandle", "str", "user32.dll", "ptr") pfn := [], bkp := [] for i, fn in ["SetForegroundWindow", "ShowWindow"] { pfn[i] := DllCall("GetProcAddress", "ptr", user32, "astr", fn, "ptr") DllCall("VirtualProtect", "ptr", pfn[i], "ptr", 8, "uint", 0x40, "uint*", 0) bkp[i] := NumGet(pfn[i], 0, "int64") } } if (A_PtrSize=8) { ; Disable SetForegroundWindow and ShowWindow. NumPut(0x0000C300000001B8, pfn[1], 0, "int64") ; return TRUE NumPut(0x0000C300000001B8, pfn[2], 0, "int64") ; return TRUE } else { NumPut(0x0004C200000001B8, pfn[1], 0, "int64") ; return TRUE NumPut(0x0008C200000001B8, pfn[2], 0, "int64") ; return TRUE } static cmds := {ListLines:65406, ListVars:65407, ListHotkeys:65408, KeyHistory:65409} cmds[Command] ? DllCall("SendMessage", "ptr", A_ScriptHwnd, "uint", 0x111, "ptr", cmds[Command], "ptr", 0) : 0 NumPut(bkp[1], pfn[1], 0, "int64") ; Enable SetForegroundWindow. NumPut(bkp[2], pfn[2], 0, "int64") ; Enable ShowWindow. ControlGetText, text,, ahk_id %hEdit% return text }
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot] and 70 guests