Combining keyboard with mouse

Class library usage, coding and language questions.
bob
Posts: 2
Joined: Sun Oct 01, 2006 4:01 pm

Combining keyboard with mouse

Post by bob » Sun Oct 01, 2006 4:03 pm

Is it possible to perform something like a mouse click while SHIFT/CONTROL/ALT key is pressed?

Bob

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Sun Oct 01, 2006 5:24 pm

bob wrote:Is it possible to perform something like a mouse click while SHIFT/CONTROL/ALT key is pressed?
I'm sorry, we have some undocumented features, but the answer is yes:

Code: Select all

form.SendKeys("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}");
Application.Sleep(100);
Mouse.Click(MouseButtonType.LeftButton);
form.SendKeys("{SHIFTUP}{CTRLUP}{ALTUP}");
or

Code: Select all

Application.SendKeys("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}");
Application.Sleep(100);
Mouse.Click(MouseButtonType.LeftButton);
Application.SendKeys("{SHIFTUP}{CTRLUP}{ALTUP}");
Jenö Herget
Ranorex Team

bob
Posts: 2
Joined: Sun Oct 01, 2006 4:01 pm

Post by bob » Mon Oct 02, 2006 5:26 pm

Thanks for the help.

This seems the C code to me, I am using python. What I have tried in python is:

Code: Select all

   
app = R.FormGetActive()
    R.ControlSendKeys(app,"e")
    R.ControlSendKeys(app,"{SHIFTDOWN}")
    R.Sleep(1000)
    R.MouseClick(R.MOUSE_LEFT_BUTTON,1)
with

Code: Select all

import RanorexPython as R
However the "e" and mouseclick are received, but the SHIFTDOWN is not (also when i manually click afterward, any ideas?

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Mon Oct 02, 2006 7:57 pm

You should use HWND=0 for the CTRL, ALT and SHIFT keys:

Code: Select all

Ranorex.ControlSendKeys(textBox,'abc')
Ranorex.ControlSendKeys(0,'{SHIFTDOWN}')
Ranorex.ControlSendKeys(textBox,'efg')
Ranorex.ControlSendKeys(0,'{SHIFTUP}')
Gabor Herget
Ranorex Team