Jump to content

Newbie need help


Recommended Posts

Hello. I am new to AutoIt and look fowarding to mastering this useful tool. My first project is to create a script to enter a username and password into a dialog box in Firefox. I have found a script from googling but not sure what fields I need to change?

AutoItSetOption("WinTitleMatchMode","2")
if $CmdLine[0] < 3 then
msgbox(0,"Error","Supply all the Arguments, Dialog title User Name, Password")
Exit
EndIf
WinWait($CmdLine[1]) ; match the window with substring
$title = WinGetTitle($CmdLine[1]) ; retrives whole window title
ControlSend($title,"","Edit2",$CmdLine[2]);Sets User Name
ControlSend($title,"","Edit3",$CmdLine[3]);Sets Password
ControlClick($title,"","OK");

Can anyone offer me a little assistance on what I need to change to get this working?

Thanks.

Link to comment
Share on other sites

I'm new-ish myself, and not too familiar with using $CmdLine parameters myself. I'd probably write something (admittedly a bit rougher) like this:

$windowname = "Name of your window here"
$username = "your username here"
$password = "your password here"
WinWait($windowname)
ControlSend($windowname, "", "Edit2", $username) ; you'll want to find out the control name of the username field (the easiest way to do this is to use the AutoIt Window Info tool), and sub it in for "Edit2"
ControlSend($windowname, "", "Edit3", $password); same as above
ControlClick($windowname, "", "text that appears that on the button you want to click")
Link to comment
Share on other sites

What you have won't work at all. The ONLY way to interact with items displayed in Firefox is to use what I told you. You can't use ControlClick, controlsend or anything that tries to directly interact with a control that is displayed in the webpage that is displayed in Firefox.

You can use "Send" as long as you make the Firefox window active first but this is horribly unreliable. This will only send text to the window in question and then if the cursor isn't in the field you want you have a failure.

Seeing how you are a beginner you should take "Autoit 1 2 3. It is located in the example scripts section of the forum.

Edited by MPH
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...