Jump to content

Trouble sending keys


Recommended Posts

I have recorded a script that cannot be played back. Our application presents a tabbed dialog, and what I've recorded is using CTRL-TAB to move across the tabs and modify values on the tabs. On the 4th tab, I arrow down through a group of radio buttons, and pick the second. Then I tab over to the text field beside that radio button and enter a value ("12", not that it matters). Then I CTRL-TAB on over to the next one tab.

The script that is recorded dies right after that "12" gets entered. When I say "dies", I mean that the CTRL-TAB that follows doesn't appear to be sent through correctly. The script hangs without transferring to the next tab. As soon as I manually click on that tab, the script picks up where it left off.

Here's the pertinent part of the code:

WinWait("Field Properties","&Duplicate order key")
Send("{TAB}{TAB}{TAB}{TAB}{TAB}{SHIFTDOWN}{TAB}{SHIFTUP}18{TAB}{TAB}32{CTRLDOWN}{TAB}{CTRLUP}{TAB}{SPACE}{CTRLDOWN}{TAB}{TAB}{CTRLUP}")
If Not WinActive("Field Properties","&Duplicate order key") Then WinActivate("Field Properties","&Duplicate order key")
WinWaitActive("Field Properties","&Duplicate order key")
Send("{CTRLDOWN}{TAB}{CTRLUP}{DOWN}12{CTRLDOWN}{TAB}{CTRLUP}")  ; Nothing after the 12 seems to go
WinWait("Field Properties","&1 - Add - Audits th")
If Not WinActive("Field Properties","&1 - Add - Audits th") Then WinActivate("Field Properties","&1 - Add - Audits th")
WinWaitActive("Field Properties","&1 - Add - Audits th")
Send("{SPACE}{CTRLDOWN}{TAB}{CTRLUP}")
WinWait("Field Properties","Prompt/edits against")
If Not WinActive("Field Properties","Prompt/edits against") Then WinActivate("Field Properties","Prompt/edits against")
WinWaitActive("Field Properties","Prompt/edits against")
Send("{TAB}{TAB}special{SPACE}instructions{TAB}{SPACE}")

I've also attached a screenshot. Any idea why the CTRL-TAB doesn't go through? I really wanted to drive this app with keys rather than the mouse.

post-16459-1159902729_thumb.jpg

Link to comment
Share on other sites

I agree with Confuzzled.....most of the time when I've seen this it is because the timing of the send gets off track. If you play around with some Sleep statements and their wait times you can clear up those kind of issues.

Edited by Agent Orange
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...