Highlighted
Absent Member.. Absent Member..
Absent Member..
491 views

How to pass keyboard strokes when starting application within UFT script

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.. Absent Member..
Absent Member..

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

View solution in original post

1 Reply
Highlighted
Absent Member.. Absent Member..
Absent Member..

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

View solution in original post

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.