hot key support
hot key support
How do you press hot keys like alt+f? I noticed a post that mentioned you could use {ALTDOWN} to hole the alt key down, but that doesn't seem to work in version 2. Any suggestions?
Thanks.
Thanks.
Thanks for the quick reply. For some reason, that doesn't seem to work for me. I am trying to access a text box and type something in it, so I thought it might be easier to just use the hot key for the text box and then start typing since the only thing different about the text boxes are the controlID. Is the controlID going to be the same every time on every machine?
Thanks.
Thanks.
I guess that kind of depends. What does the spy tool tell you?
Can you click and set focus to the text box based on it's name or a unique ID?
Is the text box getting focus before you start typing in it?
The Keyboard.Press method should be issuing the keys you tell it to. What is you code for setting focus to the text box before you start typing?
Can you click and set focus to the text box based on it's name or a unique ID?
Is the text box getting focus before you start typing in it?
The Keyboard.Press method should be issuing the keys you tell it to. What is you code for setting focus to the text box before you start typing?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
The code for the Keyboard.Press should look like the following:
Please consult the API documentation of the Keyboard.Press method for more information on the valid syntax for that method.
Usually, you can also try to record your keystrokes using the RanorexRecorder, however, in this special case (combinations of Alt/Ctrl and another key) the Recorder in V2.0 generates a buggy string. This error will be fixed in the upcoming V2.0.2.
Regards,
Alex
Ranorex Support Team
Code: Select all
Keyboard.Press("{Alt down}{fkey}{Alt up}");
// or
Keyboard.Down(Keys.LMenu);
Keyboard.Press(Keys.F);
Keyboard.Up(Keys.LMenu);
Usually, you can also try to record your keystrokes using the RanorexRecorder, however, in this special case (combinations of Alt/Ctrl and another key) the Recorder in V2.0 generates a buggy string. This error will be fixed in the upcoming V2.0.2.
Regards,
Alex
Ranorex Support Team
Are you suggesting that what I am using should not work? It does...
Visiting the API Documentation for the Keyboard.Press method in turn takes you to the MSDN Keys Enumeration documentation http://msdn.microsoft.com/en-us/library ... .keys.aspx.
This documentation clearly states that the Alt key modified is {Alt}. So it would appear that we are both right, but the method you describe with the {Alt down} and {Alt up} is just a longer way of doing it.
Code: Select all
Keyboard.Press("{ALT}fo");
This documentation clearly states that the Alt key modified is {Alt}. So it would appear that we are both right, but the method you describe with the {Alt down} and {Alt up} is just a longer way of doing it.
Thanks for all the suggestions. I did the following:
That works now. Thanks for all the quick responses.
Code: Select all
textBox.EnsureVisible();
Keyboard.Press("{Alt down}{fkey}{Alt up}");
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
I bet your code works as well for most shortcuts, but sometimes you need to hold down the ALT key while pressing the shortcut key. Your code means:Ciege wrote:Are you suggesting that what I am using should not work? It does...Code: Select all
Keyboard.Press("{ALT}fo");
- press the ALT key
- release the ALT key
- press and release the F key
- press and release the O key
The code I posted holds down the ALT key while pressing/releasing the F key. It's just two ways to invoke shortcuts

Regards,
Alex
Ranorex Support Team
Hmmm, interesting. If that what it truly means then I wonder why it works like Alt+F. If it was just doing Alt-down, Alt-Up, F I would expect that the file menu in the AUT would not actually open since it requires an Alt+F.Support Team wrote:Your code means:
- press the ALT key
- release the ALT key
- press and release the F key
- press and release the O key
Regardless, I'll keep this info in mind incase it comes back to haunt me in the future.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
If you press (and release) ALT, in most applications the focus moves to the menu and the following character determines the menu that is opened. However, with some applications that's not true and you need to hold down the ALT key while pressing the right character. Usually, the second way (holding down ALT while pressing character) is the safer one that should work almost evertime 
Regards,
Alex
Ranorex Support Team

Regards,
Alex
Ranorex Support Team
Re: hot key support
what will be the shortcut key for {TAB}
Thank you
Beginner
Thank you
Beginner
Re: hot key support
What do you mean by shortcut key for {TAB}? Do you mean, how do you type tab? If yes... useomayer wrote:what will be the shortcut key for {TAB}
Thank you
Beginner
Code: Select all
{TAB}
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: hot key support
am i missing something - trying to use ctrl an f to popup the find box using
Keyboard.Press("{Ctrl down}{fkey}");
but getting error - 'ctrl' is not a valid member of the System.Windows.Forms.Keys enumeration.
Thank you in advance-
Keyboard.Press("{Ctrl down}{fkey}");
but getting error - 'ctrl' is not a valid member of the System.Windows.Forms.Keys enumeration.
Thank you in advance-
Tipu
Re: hot key support
A quick google of "System.Windows.Forms.Keys" reveals this lik: http://msdn.microsoft.com/en-us/library ... .keys.aspx
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...