How to send Ctrl + Ctrl command to my application?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

How to send Ctrl + Ctrl command to my application?

Post by aqua267 » Tue Oct 26, 2010 2:25 pm

Hello,

I need to send the command Right Ctrl + left Ctrl to launch a dialog box in my application.
I tried this
Press Ctrl
Press Ctrl
Release Ctrl
But this does not launch the dialog box. Please help.

thanks.

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Oct 26, 2010 2:42 pm

Did you try?

Code: Select all

Press RCtrl
Press LCtrl
Release RCtrl
Release LCtrl
Or some other combination of press and release

See help for press

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Tue Oct 26, 2010 2:43 pm

Try this:

Code: Select all

//Key codes at <a>http://www.mjtnet.com/vkcodes.htm</a>
Let>VK_LCONTROL=162
Let>VK_RCONTROL=163
Let>ExtendedKey=1
Let>KeyUp=2

//Press right control Key
LibFunc>user32.dll,keybd_event,r,VK_RCONTROL,0,ExtendedKey,0

Wait>0.5

//Press left control Key
LibFunc>user32.dll,keybd_event,r,VK_LCONTROL,0,ExtendedKey,0

//Now release Control Keys
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_LCONTROL,0,FLAGS,0

aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

Post by aqua267 » Tue Oct 26, 2010 3:16 pm

Thanks much for your replies. Both options worked.
However after I run my script with the second solution (LibFunc), I can not type anything in my computer. It looks like it treats them as short cut keys and launches windows in other applications?
Any insights on how to prevent this?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts