Hotstrings as commands?

Coordinator
Feb 14, 2014 at 7:54 PM
Edited Feb 14, 2014 at 7:57 PM
Espen asked the following question via email:
Hello,
I am starting to use AHK command picker (wonderful tool, by the way!), and have a number of abbreviations I use when I'm in the command prompt or SecureCRT and working with routers and switches (e.g. ipc = ipconfig /all, scn = show cdp neighbor detail etc). Is there a way to add abbreviations into functions so they can be used with AHK command picker? Or do all of the abbreviations then have to use a shortcut key combination instead such as Alt+i?
Espen Paulsberg
Coordinator
Feb 14, 2014 at 8:14 PM
Hi Espen, if you want to use hotstrings as you always have, you still can; just add the hotstring code to the MyHotkeys.ahk file. e.g.
::ipc::ipconfig /all
Or if you prefer to trigger it using a hotkey, you could add this to MyHotkeys.ahk:
!i::SendInput, ipconfig /all
If you want to use a Command to type out the text for you, then you can add something similar to this to the MyCommands.ahk file.
AddNamedCommand("ipc", "TypeIpconfigAll", "Types 'ipconfig /all' in the active window.")
TypeIpconfigAll()
{
    SendInput, ipconfig /all
}
And if you don't care about the actual function name being descriptive, you could shorten it to this:
AddCommand("ipc", "Types 'ipconfig /all' in the active window.")
ipc()
{
    SendInput, ipconfig /all
}
I hope this answers your question.
Marked as answer by deadlydog on 2/14/2014 at 1:14 PM