How to pass keyboard strokes when starting application within UFT script

Hi.  Seems easy enough, but I'm struggling with how to start our AUT with a keystroke combination.

Here's the psuedo code

- Click a desktop icon (can be the actual location...c:\app\test.exe if easier)

- Press and hold the ctrl and shift keys and press enter (micCtrlDwn micShiftDwn micReturn)

- Undo the holds (micShiftUp micCtrlUp)

 

I've tried systemutil.run and activateap, to no avail.  

Anybody know what I'm doing wrong?

 

Thanks

Parents
  • Verified Answer

    Hey Bret,

    Try this


     Set dr = CreateObject("Mercury.DeviceReplay")
        dr.KeyDown 29 'PRESS THE CONTROL KEY DOWN & HOLD "29" IS ASCII CODE FOR "CONTROL"
        dr.KeyDown 42 'PRESS THE SHIFT KEY DOWN & HOLD "42" IS ASCII CODE FOR "SHIFT"
        wait 5
        systemUtil.Run -----> applicaton path here
         wait 5 'WAIT BEFORE RELEASING THE KEYS
        dr.KeyUp 29 'RELEAS THE CONTROL KEY "29" IS ASCII CODE FOR "CONTROL"
        dr.KeyUp 42 'PRESS THE SHIFT KEY "42" IS ASCII CODE FOR "SHIFT"
        wait 5 ' MAKE SURE THE KEYS ARE RELEASED
    Set dr = Nothing

Reply
  • Verified Answer

    Hey Bret,

    Try this


     Set dr = CreateObject("Mercury.DeviceReplay")
        dr.KeyDown 29 'PRESS THE CONTROL KEY DOWN & HOLD "29" IS ASCII CODE FOR "CONTROL"
        dr.KeyDown 42 'PRESS THE SHIFT KEY DOWN & HOLD "42" IS ASCII CODE FOR "SHIFT"
        wait 5
        systemUtil.Run -----> applicaton path here
         wait 5 'WAIT BEFORE RELEASING THE KEYS
        dr.KeyUp 29 'RELEAS THE CONTROL KEY "29" IS ASCII CODE FOR "CONTROL"
        dr.KeyUp 42 'PRESS THE SHIFT KEY "42" IS ASCII CODE FOR "SHIFT"
        wait 5 ' MAKE SURE THE KEYS ARE RELEASED
    Set dr = Nothing

Children
No Data