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

Add support for different case of text and modifiers when using the Type function #11

Open
nagilum opened this issue May 27, 2021 · 4 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@nagilum
Copy link

nagilum commented May 27, 2021

I want to send the keypresses for the string "This is a test!" but it turns into "this is a test1". I'm assuming the letters are reduced to their respective key and the modifiers aren't kept. So "T" becomes "t" and "!" becomes "1" because the "!" characters is a modifier of the "1" button on my keyboard. (Norwegian)

I tried to use robot.CombineKeys(Key.Shift, Key.T); to get the upper case T, which worked, but it would be nice if the Type() function handled that for me.

The exclamation point didn't work with robot.CombineKeys(Key.Shift, Key.One); tho. For some reason it printed "Z" to me..

@lucassklp lucassklp self-assigned this Jun 13, 2021
@lucassklp lucassklp added bug Something isn't working enhancement New feature or request labels Jun 13, 2021
@lucassklp
Copy link
Owner

Sorry for delaying on reply.
What SO are you using?

By the way, I think you're using the wrong function. CombineKeys may works, but this method is not supposed to do what you want. Try using this overload of Type funcion:

robot.Type(Key.Shift, Key.T);
https://github.com/lucassklp/Desktop.Robot/blob/main/Desktop.Robot/Extensions/TypingExtension.cs#L30

Regarding the problem related to Shift + 1, I'll check it out!

@EightNetNz
Copy link

In Keys.cs windows Keycode for numbers Zero to Nine are all 0x5A same as 'Z', should be 0x30 - 0x39.

    ...

    [Keycode(Platform = "OSX", Keycode = 0x06)]
    [Keycode(Platform = "Windows", Keycode = **0x5A**)]
    [Keycode(Platform = "Linux", Keycode = 0x007a)]
    Z,
    
    //Numbers
    [Keycode(Platform = "OSX", Keycode = 0x30)]
    [Keycode(Platform = "Windows", Keycode = **0x5A**)]
    [Keycode(Platform = "Linux", Keycode = 0x0030)]
    Zero,

@olivercoad
Copy link
Contributor

Try using this overload of Type funcion:
robot.Type(Key.Shift, Key.T);

I don't think that would work, it'll just press shift and then t without holding shift. CombineKeys is the correct method to use for that.

@lucassklp
Copy link
Owner

@EightNetNz This PR fixes that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants