Get the command currently assigned to a keyboard shortcut

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
jupe
Posts: 3569
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Get the command currently assigned to a keyboard shortcut

Post by jupe »

Pretty much anything is possible depending on how much time you want to spend scripting it, but just putting them in a in a sorted list is pretty quick if that will do, eg

Code: Select all

  $keys = "F6|F9|Ctrl+F3|Shift+F12|F12";
  $cmds = regexmatches(<get listofcommands 2>, "^.+\t(" . replace($keys, "+", "\+") . ")$", <crlf>);
  inputselect(, formatlist(regexreplace($cmds, "^.+\|(.+?)\t(.+?)$", "$2<tab 2>$1"), n, <crlf>), <crlf>, 0);
As for why F12 isn't in your output, I can only imagine maybe it isn't set in your config, or you have set it wrong in the script because it works fine using the above script.

kiwichick
Posts: 732
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Get the command currently assigned to a keyboard shortcut

Post by kiwichick »

jupe wrote: ↑04 Oct 2026 05:55 putting them in a in a sorted list (not specifically the $keys order) is pretty quick if that will do
If possible I would like them to be in the order I have them in $keys eg: F keys first, Shift+F keys next, Ctrl+F keys last.
As for why F12 isn't in your output, I can only imagine maybe it isn't set in your config
It was set in my config but I hadn't removed the original shortcut. After I did that, F12 was in the output.
Windows 10 Pro 22H2
Scaling 150%

jupe
Posts: 3569
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Get the command currently assigned to a keyboard shortcut

Post by jupe »

Maybe something like this should work for $keys sorted,

Code: Select all

  $out  = "";
  $keys = "F6|F9|Ctrl+F3|Shift+F12|F12";
  $keys = replace($keys, "+", "\+");
  $cmds = regexmatches(<get listofcommands 2>, "^.+\t($keys)$", <crlf>);
  $cmds = regexreplace($cmds, "^.+\|(.+?)\t(.+?)$", "$2<tab 2>$1");
  foreach($k, $keys) { $out .= regexmatches($cmds, "^$k\t+.+?$") . <crlf>; }
  inputselect(, $out, <crlf>, 0);

kiwichick
Posts: 732
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Get the command currently assigned to a keyboard shortcut

Post by kiwichick »

jupe wrote: ↑04 Oct 2026 06:26 Maybe something like this should work for $keys sorted,

Code: Select all

  $out  = "";
  $keys = "F6|F9|Ctrl+F3|Shift+F12|F12";
  $keys = replace($keys, "+", "\+");
  $cmds = regexmatches(<get listofcommands 2>, "^.+\t($keys)$", <crlf>);
  $cmds = regexreplace($cmds, "^.+\|(.+?)\t(.+?)$", "$2<tab 2>$1");
  foreach($k, $keys) { $out .= regexmatches($cmds, "^$k\t+.+?$") . <crlf>; }
  inputselect(, $out, <crlf>, 0);
Perfect!!! Thank you so much.
Windows 10 Pro 22H2
Scaling 150%

Post Reply