Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Listen for key combinations, such as Ctrl+C and Ctrl+Win+Right Arrow
#1
Hello,

I need to create some functions to listen for Windows key combinations, such as Ctrl+Win+Right Arrow (Desktop Next).
When I run the following program and press the keys manually, it works fine.
However, when I press the Desktop Next key(a special function key) on the keyboard, it seems only Ctrl is captured and blocked, while Win+Right Arrow is executed.
 
Code:
Copy      Help
var timeOutTime = -3;
if (keys.waitForKey(timeOutTime, KKey.Ctrl, up: false, block: true) &&
    keys.waitForKey(timeOutTime, KKey.Win, up: false, block: true) &&
    keys.waitForKey(timeOutTime, KKey.Right, up: false, block: true))
{
    print.it("Pass");
}
else
{
    print.it("Fail");
}

I can't use "
 
Code:
Copy      Help
if (keys.waitForHotkey(-3, "Ctrl+Win+Right"))
 "because it results in "Failed to register hotkey. Hot key is already registered (1409)."

Sorry, I’m a beginner. My code is based on examples from the cookbook and responses from ChatGPT.
Is there any other way to achieve this functionality? I would really appreciate it.
Thanks.


Messages In This Thread
Listen for key combinations, such as Ctrl+C and Ctrl+Win+Right Arrow - by Tsunlong - 02-25-2025, 08:28 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)