Page 1 of 2
Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 06:05
by kiwichick
Is it possible to use scripting to get the command for a specific keyboard shortcut? For example: get the command currently assigned to F6. If it is possible, can I create a script to get a list of commands for specified shortcuts? For example: get the commands currently assigned to F6, F9, Ctrl+F3, Shift+F12. I am constantly forgetting which commands are assigned to some shortcuts so it would be really helpful to be able to use a script to get them.
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 06:16
by jupe
If you just open the
Help | List All Commands
dialog and type the keyboard shortcut it will tell you what it does
Otherwise yes you can get them by scripting via
get("ListOfCommands");
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 06:19
by kiwichick
jupe wrote: ↑01 Oct 2026 06:16
If you just open the
Help | List All Commands
dialog and type the keyboard shortcut it will tell you what it does
Otherwise yes you can get them by scripting via
get("ListOfCommands");
Yes, I know about those options but I don't want a list of all the commands, only certain ones.
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 06:24
by jupe
Well then parse the list.
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 06:27
by kiwichick
jupe wrote: ↑01 Oct 2026 06:24
Well then parse the list.
Thanks, but I don't know how to do that.
Edited to add: I should say I know what parsing a list is but I don't know how I would do it to get the shortcut commands.
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 06:41
by jupe
I misunderstood again, since asking if its possible didn't seem the same as write a script for me, anyway maybe something like this could work:
Code: Select all
$k = "F6|F9|Ctrl+F3|Shift+F12"; text regexmatches(<get listofcommands 2>, "^.+\t(" . replace($k, "+", "\+") . ")$", <crlf>);
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 10:24
by kiwichick
jupe wrote: ↑01 Oct 2026 06:41
I misunderstood again, since asking if its possible didn't seem the same as write a script for me
No, you didn't misunderstand. I wasn't clear about what I needed. Thanks for the code. I can definitely work with that but I was hoping to get a list that's a bit tidier to look at. So, maybe with the keyboard shortcut first and then the command, with no other info included (ie: the menu entries for the commands).
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 11:13
by highend
Code: Select all
$keys = "F6|F9|Ctrl+F3|Shift+F12";
$matches = regexmatches(<get listofcommands 2>, "^.+\t(" . replace($keys, "+", "\+") . ")$", <crlf>);
$reorder = regexreplace($matches, "^(.*?\t)(.*?)$", "$2<>$1");
text regexreplace($reorder, "^(.*?)<>.*\|[ ]+(.*?)\t+$", "$1 = $2");
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 21:33
by jupe
Alternative below, in case you might want it in a filterable list:
Code: Select all
$keys = "F6|F9|Ctrl+F3|Shift+F12";
$cmds = regexmatches(<get listofcommands 2>, "^.+\s+(" . replace($keys, "+", "\+") . ")$", <crlf>);
inputselect(, regexreplace($cmds, "^.+\|(.+?)\t(.+?)$", "$2<tab 2>$1"), <crlf>, 0);
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 22:40
by phred
Both scripts by highend and jupe are helpful. I'm struggling with how to modify either one so that it returns all keyboard shortcuts that are currently assigned.
Thanks.
Re: Get the command currently assigned to a keyboard shortcut
Posted: 01 Oct 2026 23:03
by jupe
@phred: Below would be one way that should work, output into a filterable list, depending on your requirements you might want the output tidied up more.
Code: Select all
inputselect(, regexreplace(formatlist(<get listofcommands 2>, f, <crlf>, "!*<tab>"), "^.+\|(.+?)\t(.+?)$", "$2<tab 2>$1"), <crlf>, 0);
edit: Output sanatized version:
Code: Select all
$out = "";
$cmds = regexreplace(<get listofcommands 2>, "^.+\t(\r\n|$)");
$cmds = regexreplace($cmds, "^.+\|(.+?)\t(.+?)$", "$2<tab>$1");
foreach($t, $cmds, <crlf>) { $l = strlen(gettoken($t, 1, <tab>)); $max = $l > $max ? $l : $max; }
foreach($l, $cmds, <crlf>) {
$key = gettoken($l, 1, <tab>);
$out .= "$key<pad $max>" . gettoken($l, -1, <tab>) . <crlf>;
}
inputselect(, formatlist($out, "ne", <crlf>), <crlf>, 4096+16384);
Re: Get the command currently assigned to a keyboard shortcut
Posted: 02 Oct 2026 03:06
by RalphM
Great little script, thanks

Re: Get the command currently assigned to a keyboard shortcut
Posted: 02 Oct 2026 04:13
by phred
jupe wrote: ↑01 Oct 2026 23:03
edit: Output sanatized version:
Thank you, jupe. Does just what I was hoping for.
Re: Get the command currently assigned to a keyboard shortcut
Posted: 04 Oct 2026 05:18
by kiwichick
highend wrote: ↑01 Oct 2026 11:13
Code: Select all
$keys = "F6|F9|Ctrl+F3|Shift+F12";
$matches = regexmatches(<get listofcommands 2>, "^.+\t(" . replace($keys, "+", "\+") . ")$", <crlf>);
$reorder = regexreplace($matches, "^(.*?\t)(.*?)$", "$2<>$1");
text regexreplace($reorder, "^(.*?)<>.*\|[ ]+(.*?)\t+$", "$1 = $2");
Thank you!! Is it possible for the output to be listed in the same order as written in $keys? No matter what order I put them in the output is Shift+F12, Ctrl+F3, F9, F6. Also, if I change $keys to F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12, why isn't F12 included in the output?
Re: Get the command currently assigned to a keyboard shortcut
Posted: 04 Oct 2026 05:41
by kiwichick
jupe wrote: ↑01 Oct 2026 21:33
Alternative below, in case you might want it in a filterable list:
Code: Select all
$keys = "F6|F9|Ctrl+F3|Shift+F12";
$cmds = regexmatches(<get listofcommands 2>, "^.+\s+(" . replace($keys, "+", "\+") . ")$", <crlf>);
inputselect(, regexreplace($cmds, "^.+\|(.+?)\t(.+?)$", "$2<tab 2>$1"), <crlf>, 0);
Thank you!! Is it possible for the output to be listed in the same order as written in $keys? No matter what order I put them in the output is Shift+F12, Ctrl+F3, F9, F6. Also, if I change $keys to F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12, why isn't F12 included in the output?