Jump to content

Manually Inputting data during Autoit Script?


Recommended Posts

Hi everyone!

First off I would like to say thanks to everyone who has posted. I've only been working with Autoit for two days now and I can already see the awesome potential it holds - mainly from the examples and discussions I've been exposed to.

This is probably something very simple but I haven't been able to find it in the help files or on the forum.

So here's what I'm looking for. It's basically an input box which will also send the input to whatever program the Autoit script is running with. I.E when the script opens aol.com it will prompt me with a message box which requires me to enter data. This data is then entered into the respective fields and the script continues on.

I understand I could assign a variable before hand, but rather then edit the script with each new user, a Msgbox type prompt would be perfect!

Any code or a point in the right direction would be awesome.

Thanks again!

~Steve

Link to comment
Share on other sites

Right, I need an inputbox but I need the data I enter into it to ALSO be entered into the program (like internet explorer) that my autoit script is running with.

So it's like using this inputbox to SEND the data I enter into it. If that's what it does already, maybe I did something wrong when I tried the first time?

Link to comment
Share on other sites

badlmixture,

You are saying several inconsistent/contradictory things here. Supply some code and/or more specific detail about your needs.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Here is an example of code I use that does something similar to this. You will need to adjust this to do whatever it is you want with the information you obtain...

$userName = InputBox("Security Check", "Enter your user name.")
$userPassword = InputBox("Security Check", "Enter your password.","","*")

$winName = "Proprietary Login"
while 1
    sleep(1000)
    If WinExists($winName) And WinExists("Login") Then
        sleep(1000)
        ControlSetText("Login","","[NAME:txtUserName]",$userName)
        sleep(250)
        ControlSetText("Login","","[NAME:txtPassword]",$userPassword)
        sleep(250)
        ControlClick("Login","","[NAME:btnLogin; TEXT:F5-Login]")
        ConsoleWrite("Logging in" & @CRLF)
        WinWait("$winName") 
        ControlClick("Login","","[NAME:btnLogin; TEXT:F5-Login]")
        ConsoleWrite("Logged in good to go!" & @CRLF)
    EndIf
WEnd

-K

Link to comment
Share on other sites

Thanks for all the response guys! I think i found a perfect way to explain what I'm trying to do.

Here's a script I wrote to open a new gmail account. Everything uses variables until I reach the captcha.

I'm not trying to bypass the captcha, but I'm looking for an input box to pop up asking ME to MANUALLY enter the captcha I see, which would then be sent to my internet explorer and the script would finish making the account. Obviously since the captcha is different every time I cant set a variable beforehand and need to be present to manually enter it myself!

Here's the code I'm using. It stops where i'm asked for the captcha.

Run("C:\Users\Home\AppData\Local\Google\Chrome\Application\chrome.exe")

_WinWaitActivate("Google - Google Chrome", "")

Send("gmail{ENTER}")

Sleep(1005)

_WinWaitActivate("gmail - Google Search - Google Chrome", "")

Send("{TAB}{TAB}{TAB}{ENTER}")

Sleep(2000)

_WinWaitActivate("Google Accounts - Google Chrome", "")

Send("{TAB}{TAB}{TAB}{TAB}")

Send($fname, 1)

Send("{TAB}")

Sleep(2030)

Send($lname, 1)

Send("{TAB}")

Send($uname, 1)

Sleep(1000)

Send("{TAB}{TAB}")

Send($pw, 1)

Sleep(2020)

Send("{TAB}")

Send($pw, 1)

Send("{TAB}{TAB}{SPACE}{TAB}{TAB}{DOWN}{TAB}{TAB}")

Sleep(1406)

Send($fakename, 1)

Send("{TAB}")

Sleep(2272)

Send($fakeemail, 1)

Send("{TAB}{TAB}{TAB}")

Sleep(1000)

Send($date, 1)

Send("{TAB}")

ENTER CAPTCHA MANUALLY <----- ???

Exit

I tried inputbox and msgbox but neither of them actually sent the info I entered into them to my internet explorer, leaving my captcha field blank.

Hope that explains a little better.

Thanks again!

~Steve

Link to comment
Share on other sites

Are you trying to register accounts via script with limited interaction? I pretty much gave you the answer to this already but if you can clarify exactly what you are trying to accomplish that would be great.

-K

Link to comment
Share on other sites

Ok thanks everyone!

After checking out kelsets code and a few other posts I understand how to easily accomplish what I was after, which is using inputbox to configure a variable within a script.

$userName = InputBox("Security Check", "Enter your user name.")

Send($userName, 1)

This will send whatever I type in the inputbox when it pops up to whatever program I'm working with!

Awesome!

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...