Sign in to follow this  
Followers 0
Space

Help with Pausing a Script

3 posts in this topic

All-

I'm a newbie, and I'm really liking AutoIt.

I'm trying to do a data conversion, having AutoIt send keystrokes to a web-based application. I've used the AutoIt Windows Info, but the application seems to be coded in such a way that I'm having difficulty identifying the names of the textbox controls, so... I'm using mouse click and repeating a set of keystrokes over and over.

My problem is - I'm having difficulty determining the proper length of the 'Sleep' to use. Sometimes the script processes smoothly, other times the next set of sendkeys text gets garbled in the textbox (and saved - ick!)

So... Is my best option to have the script pause, until I press a key (once everything looks like it has processed? Or is there a better alternative. Of course, code samples are always appreciated.

Here is what my script looks like, I've played around with Sleep(1000), Sleep(5000), and I'm still having intermittent difficulties even with Sleep(10000).

Please Help!

MouseClick("left",458,390,2) ;focus on the text box

Sleep(100)

Send("3LBY PCGBHA") ;enter text into the text box (the line that changes in the repetitive process)

Sleep(100)

Send("{TAB}") ;tab to the save button

Sleep(100)

Send("{ENTER}") ; click the save button

Sleep(10000) ;sometimes doesn't work, and 3LCA PCGFAA appears in the text box with 3LBY PCGBHA

MouseClick("left",458,390,2)

Sleep(100)

Send("3LCA PCGFAA")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{ENTER}")

Sleep(10000)

MouseClick("left",458,390,2)

Sleep(100)

Send("3LCB PCGEDA")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{ENTER}")

Sleep(10000)

Share this post


Link to post
Share on other sites



Would WinExists or WinActive be appropriate? Or if it's run through IE, Dale's IE.au3 library is most likely a better way to handle things.


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

Try experimenting with higher values than the defaults for Opt("SendKeyDelay",x) and Opt("SendKeyDownDelay",x). Perhaps the app doesn't process your keystrokes correctly if they're sent with the defaults for these options (both 5 miliseconds - perhaps you need to grant it more time by setting both to 20 or 50 or so?)

Good luck.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

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  
Followers 0