How do I resize windows using only the keyboard?

How do I resize windows using only the keyboard?

By utilising a series of TypeKeys() method calls, we can simply use the keyboard to re-size any window.

Standard keys "Alt+Space" bring up the System Menu for the window you are working in. This menu contains Size and Move options.

The Size option turns the cursor into a directional compass, positioned in the centre of the current window. Pressing any of the arrow keys turns the cursor into a resize cursor, and moves it to the relevant edge of the window.

You can now shift that edge of the window either horizontally or vertically. If you want diagonal resizing from the corner of a window, press the up then the right arrow key (or any other horizontal + vertical combination), and use the directional keys to resize that corner in any direction. Press "Enter" to fix the resize, or "Escape" to restore its previous dimensions. The following script executes against the provided SilkTest JFC Sample TestApp and demos the above work flow.

[ ] TestApplication.SetActive()
[ ] //select Size Option
[ ] TestApplication.TypeKeys("")
[ ] TestApplication.TypeKeys("")
[ ]
[ ] TestApplication.TypeKeys("")
[ ] sleep(5)
[ ] //TestApplication.TypeKeys("")
[ ]
[ ] //The values 5 can be changed to increase/decrease the size
[ ] TestApplication.TypeKeys("")
[ ] TestApplication.TypeKeys("")
[ ] TestApplication.TypeKeys(""
[ ] Sleep (5)

Old KB# 23401


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:34
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.