SC: get hotkey-combo that started the script?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
autocart
Posts: 1391
Joined: 26 Sep 2013 15:22

SC: get hotkey-combo that started the script?

Post by autocart »

Hi all,
Is it somehow possible to get the hotkey-combo by which a script was called (if that was the case)?
I know about get("Shift") but I would like to know the whole key-combination, not just the modifier keys.
Thx in advance.

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC: get hotkey-combo that started the script?

Post by highend »

Code: Select all

    $caption  = "Test current script";
    $commands = get("listofcommands", 2);
    $ourself  = regexmatches($commands, $caption . ".*");
    $keyCombo = regexreplace($ourself, "^(.*\()(.*?)(\))", "$2");
$caption = Caption of the script in e.g. UDC - Load Script File - Caption
One of my scripts helped you out? Please donate via Paypal

autocart
Posts: 1391
Joined: 26 Sep 2013 15:22

Re: SC: get hotkey-combo that started the script?

Post by autocart »

Wow, nice, how do u even KNOW such things?
One thing, though. AFAI can see that construct does not return the info, whether the script was actually called by that hotkey (or by some other way).
Is that possible also, with some more of ur magic?

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC: get hotkey-combo that started the script?

Post by highend »

1. Get what XY makes available via scripting
2. Creative use of it (parse it)
3. Hope that Don will finally switch all config files into plain readable (non binary) files
-> More profit

If it was called: Not for scripts that didn't use a modifier, otherwise get("shift") and if one of it's values are present, the script was called via the hotkey (at least with a 99% chance)
One of my scripts helped you out? Please donate via Paypal

autocart
Posts: 1391
Joined: 26 Sep 2013 15:22

Re: SC: get hotkey-combo that started the script?

Post by autocart »

highend wrote:If it was called: Not for scripts that didn't use a modifier, otherwise get("shift") and if one of it's values are present, the script was called via the hotkey (at least with a 99% chance)
Mmm, thx, at least that is an idea, but for my taste a very dangerous one that I would not want to rely on. But thx anyway for the brainstorming.

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC: get hotkey-combo that started the script?

Post by highend »

Then use a background running .ahk script that checks which key was pressed and communicate with XY via WM_COPYDATA...
One of my scripts helped you out? Please donate via Paypal

autocart
Posts: 1391
Joined: 26 Sep 2013 15:22

Re: SC: get hotkey-combo that started the script?

Post by autocart »

Yes, if it is absolutely necessary then that would probably be the way to go. Thank you very much.
For now it is too much of an overhead for what I had in mind, though.

Post Reply