Operating windowskey on windows from Mac through Egplant

Hi all,
In Eggplant documenttion it is there that we can use \w\W for operating windows key on windows keyboard. But when I used that it is not enabling windows key on windows machine. Is there any settings I need to do on Mac or Windows.

Yes, either of the following code examples should press and release the Windows Key and pop open the Start menu on Windows.

typetext "\w\W"
typetext WindowsDown & WindowsUp

A few things to note:
[list]This isn’t support by ALL VNC servers (particularly older ones), but it has been tested with RealVNC 4.1.1.
In particular it does not work with TightVNC.
You will also need version 2.21 or higher of Eggplant.
From Eggplant’s Live mode you can hit the Mac Alt/Option key.
The Windows key is actually a modifier key so you can also do the following:[/list:u]

typetext WindowsDown & "e" & WindowsUp // Open Explorer Window
typetext WindowsDown & "f" & WindowsUp // Open Find Window
typetext WindowsDown & "r" & WindowsUp // Open Run... Window

One thing that stung me in the past is that most typetext seemed to work and some didn’t (It may have been the Windows key too).

I eventually realized that I cannot be lazy and assume that the release is going to be pressed for me automatically.

Try a simple example using just \w\W and make sure that works. If it does, then go back to your real script and look for a mis-matched keydown/keyup sequence.

You may find, for instance, that you are doing something like:

typetext “\aF”
typetext “\aS”

which may work fine most of the time, but it is definitely much more reliable (I’m sure the Redstone folks would say it’s required) to change those to:

typetext “\aF\A”
typetext “\aS\A”

If you took the first set of typetext commands above that don’t use the keyup and you follow them with typetext “\wF”, for instance, I think you’ll see that it doesn’t work.


That’s an excellent point!

The TypeText command treats ordinary keys (letters, digits, etc.) as down-and-up keystrokes, but not the modifier keys (shift, control, alt, etc.) which have separate codes for down and up. For the modifier keys, it’s critical that you include the code to release the key, or all of your TypeText commands after that will send keystrokes to the SUT with those modifier keys held down.

The TypeText comand was designed this way to enable you to send mouse events using modifiers as well as keystrokes. So, for example, you can “Control-Click” on something like this:

TypeText ControlDown
Click "Something"
TypeText ControlUp

Just be sure to always release those keys when you’re done!