Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

How can I write a SilkTest script to hold down the Control key while making 2 mouse clicks in a window?

How can I write a SilkTest script to hold down the Control key while making 2 mouse clicks in a window?

To show how this can be achieved, the following illustration uses Microsoft PowerPoint as an example.


I want to select two objects from the window and have them both selected at the end of the operation.

In this case I want to select both "Click to add title" and "Click to add subtitle". Manually this is done by holding down the CTRL key and clicking in the desired locations to select all the objects, then releasing the CTRL key.

Sample Testcase:

[-] testcase Test1 () appstate none
    [ ] Presentation1.SetActive ()
    [ ] Presentation1.PaneClassDC1.PressKeys("")
    [ ] Presentation1.PaneClassDC1.Click (1, 254, 230)
    [ ] Presentation1.PaneClassDC1.Click (1, 285, 342)
    [ ] Presentation1.PaneClassDC1.ReleaseKeys("")

As you can see, the testcase above uses the PressKeys method to hold down the CTRL button while other clicks are being performed. It then finishes by releasing the CTRL key with the ReleaseKeys method. You will find the testcase and include file to run this example below;

 Test.t  ppoint.inc

Additional Information:

Please note that Microsoft PowerPoint was used just as an example for this scenario. Microsoft do not use their own MFC classes for objects within Microsoft Office applications, rather they use non-standard 3rd party classes. Therefore when testing these controls via SilkTest, CustomWins are typically returned for MS Office applications and controls.

Related documents:

Old KB# 21250


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:18
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.