Ranorex

Combining keyboard with mouse

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexCore
View previous topic :: View next topic  
Author Message
bob



Joined: 01 Oct 2006
Posts: 2

PostPosted: Sun Oct 01, 2006 5:03 pm    Post subject: Combining keyboard with mouse
Is it possible to perform something like a mouse click while SHIFT/CONTROL/ALT key is pressed?

Bob
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Sun Oct 01, 2006 6:24 pm    Post subject:
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: click into code to enlarge
form.SendKeys("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}");
Application.Sleep(100);
Mouse.Click(MouseButtonType.LeftButton);
form.SendKeys("{SHIFTUP}{CTRLUP}{ALTUP}");


or

Code: click into code to enlarge
Application.SendKeys("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}");
Application.Sleep(100);
Mouse.Click(MouseButtonType.LeftButton);
Application.SendKeys("{SHIFTUP}{CTRLUP}{ALTUP}");


Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
bob



Joined: 01 Oct 2006
Posts: 2

PostPosted: Mon Oct 02, 2006 6:26 pm    Post subject:
Thanks for the help.

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


Code: click into code to enlarge
   
app = R.FormGetActive()
    R.ControlSendKeys(app,"e")
    R.ControlSendKeys(app,"{SHIFTDOWN}")
    R.Sleep(1000)
    R.MouseClick(R.MOUSE_LEFT_BUTTON,1)

with
Code: click into code to enlarge

import RanorexPython as R


However the "e" and mouseclick are received, but the SHIFTDOWN is not (also when i manually click afterward, any ideas?
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Mon Oct 02, 2006 8:57 pm    Post subject:
You should use HWND=0 for the CTRL, ALT and SHIFT keys:

Code: click into code to enlarge
Ranorex.ControlSendKeys(textBox,'abc')
Ranorex.ControlSendKeys(0,'{SHIFTDOWN}')
Ranorex.ControlSendKeys(textBox,'efg')
Ranorex.ControlSendKeys(0,'{SHIFTUP}')

Gabor Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexCore All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum