Ask a Question

press and hold control key

shirishnagarbp
New Contributor

press and hold control key

Hi,

 

For my desktop application, I want to press, hold and release (after few seconds) the control key.

 

I tried keydown, keyup but seems nothing is working.

 

tried below 2 commands but nothing seems working. Can someone please help to resolve this issue?

 

Aliases.VIP.WinFormsObject("MBSItems2ImportForm").WinFormsObject("msTreeView1").wItems.Item.KeyDown("[Ctrl]");

 

Aliases.VIP.WinFormsObject("MBSItems2ImportForm").WinFormsObject("msTreeView1").add_KeyDown("[Ctrl]");

1 REPLY 1
karkadil
Valued Contributor

Try this, this should work:

 

Sys.Desktop.KeyDown(Win32API.VK_CONTROL);
Delay(2000);
Sys.Desktop.KeyUp(Win32API.VK_CONTROL);

If you need to hold Ctrl when mouse cursor is above a specific control, you can use HoverMouse method first for that control.

cancel
Showing results for 
Search instead for 
Did you mean: