Forum Discussion

shirishnagarbp's avatar
shirishnagarbp
New Contributor
6 years ago

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

  • karkadil's avatar
    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.