Ranorex.Application.SendKeys("{{}{}}"); is outputting "{2}"

Class library usage, coding and language questions.
jdres
Posts: 3
Joined: Wed Jul 28, 2010 6:09 pm

Ranorex.Application.SendKeys("{{}{}}"); is outputting "{2}"

Post by jdres » Sat Feb 26, 2011 12:09 am

I would like my test to type: {}

The test executes the following code...

Code: Select all

public void jSendsKeys() { Ranorex.Application.SendKeys("{{}{}}"); }
But instead of sending the curly braces, it sends: {2}

In an effort to isolate the problem, I used the following code instead...

Code: Select all

public void jSendsKeys() { Ranorex.Application.SendKeys("{}"); };
This time it sends: 2

Where did the 2 come from?
How can I get it to type curly braces instead?

Here is other information that might be helpful...
- Version of Ranorex: 1.4
- Tried to manually type, and it works fine.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex.Application.SendKeys("{{}{}}"); is outputting "{2}"

Post by Support Team » Sat Feb 26, 2011 6:53 pm

jdres wrote:Where did the 2 come from?
How can I get it to type curly braces instead?
IMHO with Ranorex 1.4 you have to set the correct modifiers, too. For example, on my keyboard layout Ranorex Recorder 1.4 generates the following (correctly working) code for "{}":
Application.SendKeys("{CTRLDOWN}{ALTDOWN}{{}{CTRLUP}{ALTUP}{CTRLDOWN}{ALTDOWN}{}}{CTRLUP}{ALTUP}");
The easiest way is to record the keystrokes with Ranorex Recorder and then let it generate the corresponding code.

Regards,
Alex
Ranorex Team
.
Image