How can I simulate Clicking ShiftKey & d?

I want click “ShiftKey & d” on windows machine from Mac through Eggplant.

BTW, I have connected to Windows machine using VNC

I read the reference guide and found that TypeText ShiftKey, “d” shoiuld do the trick…but it not clicking ShiftKey and d. However, the test result window shows [ShiftKey] d successful which does not make any sense…

When I click Shift d , I will see a another image on the window…I want to test that and hence I would like to know the exact command…

I have also tried the below commands but no success…

Set the SendShiftForCaps to Yes
TypeText d

You have the correct command for sending keystrokes to the SUT. If what you want is to click the mouse while holding down certain keys, it’s a bit more work. To hold down the shift key and the D key while clicking, you would do this:

keyDown shiftKey, "d"
click "someImage"
keyUp "d", shiftKey

If what you want is to press the letter D with the shift key down, and you need to hold both of those keys down for the expected image to appear, then it would be similar:

 keyDown shiftKey, "d"
waitFor 5, "imageThatShouldAppear"
keyUp "d", shiftKey

Does that help? The TypeText command always presses and releases the keys that it types (except for a few special “down” and “up” modifier keys).

My requirement is pretty simple. Just type Shift d (which means Caps d i.e D ).

Here is psuedo code…

  1. Click a button
  2. Some screen opens up
  3. Click ShiftKey and d (i.e to simulate CAPS D)
  4. do some thing

It is too wierd that I tried to do simulate typing ShiftKey d by following your code.

keyDown shiftKey, “d”
keyUp “d”, shiftKey

If I repeatedly Run the script (containing just the above 2 lines) then after 4 or 5 clicks on Run the Script, SHift d works…

Could any one shed somelight?

The fact that it works intermittently is odd, and suggests that there might be a timing issue of some sort involved. Check that you haven’t changed any of the timing parameters (the keyDownDelay and the remoteWorkInterval in particular).

Also, you mentioned you tried the sendShiftForCaps, but did you remember to use a capital D in your script? You might try this again to be sure:

set the sendShiftForCaps to true
TypeText "D" -- use a capital D here

If those suggestions don’t help, tell us a bit more about your environment: What version of Windows are you running? What VNC server and version? What is your network like? What keyboard layout do you use? Perhaps that will help us resolve this. What you’re trying to do is very basic and generally just works.

[quote=“SenseTalkDoug”]The fact that it works intermittently is odd, and suggests that there might be a timing issue of some sort involved. Check that you haven’t changed any of the timing parameters (the keyDownDelay and the remoteWorkInterval in particular).

Also, you mentioned you tried the sendShiftForCaps, but did you remember to use a capital D in your script? You might try this again to be sure:

set the sendShiftForCaps to true
TypeText "D" -- use a capital D here

If those suggestions don’t help, tell us a bit more about your environment: What version of Windows are you running? What VNC server and version? What is your network like? What keyboard layout do you use? Perhaps that will help us resolve this. What you’re trying to do is very basic and generally just works.[/quote]

Thanks SenseTalkDoug for your prompt responses. Infact I am trying to evaluate to automate my gaming application (developed using Macromedia). Your responses are really helpful.

  1. Yes, I did use Capital D.
  2. I have windows XP, Free version of VNC 4.1.2
  3. I connected Mac and Windows using office LAN
  4. Keyboard - same standard as it comes with Windows XP. No special…

I wonder if it an issue with MAcromedia? BTW, Shift d works just normal if I do on windows machine manually…

Following up to make sure you got this resolved. I think I might have found your trouble. Your psuedo-code looks like this:

  1. Click a button
  1. Some screen opens up
  2. Click ShiftKey and d (i.e to simulate CAPS D)

I’m hoping that you actually have a line for step 2, probably a WaitFor like this:.

Click "ThisButton"
WaitFor 8.0, "AnImageOnScreen" -- Wait up to 8 seconds for that image
TypeText "D"

If you don’t then the script will very quickly just Click the button then type the text regardless of if the next screen has come up.

Mon, 5/19/08 1:31:21 PM START Running test2.script
Mon, 5/19/08 1:31:22 PM click Click_begin_assessment_button at (690, 584)
Mon, 5/19/08 1:31:28 PM waitfor Click_Bird_image found at (498, 294)
Mon, 5/19/08 1:31:28 PM typetext D
Mon, 5/19/08 1:31:28 PM SUCCESS Execution Time 0:00:06 test2.script

As soon as I type “D” I would see cheat codes…That is the only way I can test my random gaming application. So, showing up cheatcodes is important…

Yup, that’s looks just right – and you are saying that the Cheat codes don’t always show up?

What SUT and VNC Server are you testing against? That D should definitely be getting hit.

Any chance the game is available on-line anywhere that we can hit it?

Thanks you guys…You are so prompt in giving responses…

This time I have used keyDown command as suggested above.

Click “Some_Button”
keyDown shiftKey, “d”
WaitFor 5.0, “Some_Image_on_QA_Cheat_Code” – Previously I was not
waiting for this image image
keyUp “d”, shiftKey

Thanks again guys…