Sign in to follow this  
Followers 0
Drwoods

Multiple Send() methods not working

7 posts in this topic

I am tring to automate changing settings in a GUI application. However, when I put multiple send methods sequenced one after another some of them work and them it seems it just stops. I tried using one send call with multiple buttons in the arguments but it does the same thing. I also tried changing the delay time, still no luck. I am running the application on win7 if that makes a difference. I noticed there were topics pertaining to problems with vista/7. Please help me figure out how to get this working. I am new to AutoIt but not new to programming. Thanks

Share this post


Link to post
Share on other sites

I originally had it this way.

Func changeSettings()
    Run("program.exe")
    WinWaitActive("Main Window")
    Send("!s")
    WinWaitActive("SETTINGS")
    Send("{DOWN}")
    Send("!u")
    Send("{DOWN 8}")
    Send("!e")
    Send("!o")
    WinClose("Main Window")

I also tried it like this

Func changeSettings()
    Run("program.exe")
    WinWaitActive("Main Window")
    Send("!s")
    WinWaitActive("SETTINGS")
    Send("{DOWN}!u{DOWN 8}!e!o")

Both of witch never complete the last !e and !o. Thanks

Share this post


Link to post
Share on other sites

Try lengthening the SendKeyDownDelay. Maybe the program isn't recognizing the sent keys properly because they're too fast.

Put this at the start of your script:

Opt("SendKeyDownDelay", 50)

Share this post


Link to post
Share on other sites

I tried doing Opt("SendKeyDownDelay", 10) and it didn't make a difference. But i will try 50 to see what happens

Share this post


Link to post
Share on other sites

It seems to be working just fine now. Thank you. Is the 50 in milliseconds or what unit does that represent?

Share this post


Link to post
Share on other sites

It's in milliseconds. By default, AutoIt holds down a key press for 5ms.

I got the 50ms when I tried making a turbo fire button for a vertical scrolling shooter I was playing a long time ago.

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