Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard::Other(XXX).click() clicking wrong key. #11

Open
ahmedlahrizi opened this issue Aug 23, 2023 · 4 comments
Open

Keyboard::Other(XXX).click() clicking wrong key. #11

ahmedlahrizi opened this issue Aug 23, 2023 · 4 comments

Comments

@ahmedlahrizi
Copy link

I'm trying to mute sound using keyboard using this program:

When i click the mute button it works and says Jackpot, but at the start of my program, it clicks the d lettter.

Rustc version: 1.71.1
Mki version: 0.2.3

use mki::{bind_any_key, Action, Keyboard};
use Keyboard::*;

fn main() {
    println!("Hello, world!");

    Other(173).click();

    bind_any_key(Action::handle_kb(|key| {
        println!("Pessed key: {:?}", key);
        if let Other(173) = key {
            println!("Jackpot !!");
        }
    }));

    thread::sleep(Duration::from_secs(69));

    /* $obj = new-object -com wscript.shell
    $obj.SendKeys([char]173) */
}
@fulara
Copy link
Owner

fulara commented Aug 23, 2023

Is this intentional that you have this Other(173).click() thingy?
Not sure if this causes the issue you have, but looks unexpected.

@ahmedlahrizi
Copy link
Author

The problem is that this line of code clicks the d letter on my keyboard instead of the mute key.
The rest of the code is just to make sure that 173 is the right number for the mute key.

@fulara
Copy link
Owner

fulara commented Aug 25, 2023

ah! I see.

That's what I was afraid this question is about.
This might be related to this thing:
#5

I should be using scan codes.
I think VKs may not work exactly depending on keyboard layout and what not.
but that's just a guess - I'll try to give it a go sometime soon.

@ahmedlahrizi ahmedlahrizi closed this as not planned Won't fix, can't repro, duplicate, stale Aug 26, 2023
@ahmedlahrizi ahmedlahrizi reopened this Aug 26, 2023
@ahmedlahrizi
Copy link
Author

I also forgot to mention i use a french (azerty) keyboard layout, i tried qwerty but it didn't help me out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants