Jump to content
Sign in to follow this  

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")
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")
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")

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.


Share this post

Link to post
Share on other sites

happens to me sometimes its wierd i ahve send("watever") but sometimes it doesn'e happen.

2 times i can remember is i send ("^f") for find - didn't work

also for spider soilitare i send("m") for show hit - didn't work

i got the spidr solitare one to work by accident i think.

i think i deleted the entire line saved closed reopened then typed it back in and it worked.

wierd :S

"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post

Link to post
Share on other sites

Try sprinkling a few SLEEP(500) half-second waits around the place to allow the application to catch up with your script.

Share this post

Link to post
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

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...