Jump to content
Sign in to follow this  
MarcusHelo

Automatic fill in fields

Recommended Posts

MarcusHelo

Hey all!

Since this is my first post, I will introduce myself a little bit. I am Marcus Helo, 28 of age and living in Amsterdam. I got this forum recommended by a friend of mine, when I showed a lot of interest in scripting! I did a little bit in the past (VERY easy stuff, not big), which brings me to my point:

My goal is to make a program, that when executed, the script fills in a word (which is already in the script), presses "next", "enter" etc (just to proceed to the next page), if error, return to the page and fills in the second word (in the script) and so on.

I REALLY haven't got a clue where to start, and all help will be well appreciated! :D

Share this post


Link to post
Share on other sites
oMBRa

look at _IE functions

Share this post


Link to post
Share on other sites
MarcusHelo

Thank you very much! I will check it out :D

Share this post


Link to post
Share on other sites
MarcusHelo

I am trying to figure this thing out for a couple of days now, in the help file (IE functions). This is what i got so far:

_IEFormReset -> to set the filled in fields back to blank (after trying 1 word from the text)

_IEDocInsertText -> to fill in a word from a text file which i already created

_IEAction -> for some simple actions in IE, like to go back 1 page (after trying 1 word which gives an error) and forward a page after filling in a word. I'll use paste, to capy/paste a word from the text file. After every try, the next word in line needs to be tried. After "succes", i'll use stop

_IELoadWait -> to wait for the page to be loaded (after filling in a word from the text and using "enter" )

I am kinda lost, because i don't have ANY clue how to apply them. I looked around on the forum for scripts like this, but I haven't found any. Can someone give me a link where I can learn HOW to apply them? I already checked out the examples, but they couldn't help me.

This is what i got:

; *******************************************************

; Example 1 - Open a browser with the form example, fill in a form field and

; reset the form back to default values

; *******************************************************

;

#include <IE.au3>

$oIE = _IE_Example ("form")

$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")

$oText = _IEFormElementGetObjByName ($oForm, "textExample")

_IEFormElementSetValue ($oText, "Hey! It works!")

_IEFormReset ($oForm)

; *******************************************************

; Example 1 - Open a browser with the basic example page, insert text

; in and around the first Paragraph tag and display Body HTML

; *******************************************************

;

#include <IE.au3>

$oIE = _IE_Example ("basic")

$oP = _IETagNameGetCollection($oIE, "p", 0)

_IEDocInsertText($oP, "(Text beforebegin)", "beforebegin")

_IEDocInsertText($oP, "(Text afterbegin)", "afterbegin")

_IEDocInsertText($oP, "(Text beforeend)", "beforeend")

_IEDocInsertText($oP, "(Text afterend)", "afterend")

ConsoleWrite(_IEBodyReadHTML($oIE) & @CR)

; *******************************************************

; Example 2 - Same as Example 1, except instead of using click, give the element focus

; and then use ControlSend to send Enter. Use this technique when the

; browser-side scripting associated with a click action prevents control

; from being automatically returned to your code.

; *******************************************************

;

#include <IE.au3>

$oIE = _IE_Example ("form")

$oSubmit = _IEGetObjByName ($oIE, "submitExample")

$hwnd = _IEPropertyGet($oIE, "hwnd")

_IEAction ($oSubmit, "focus")

ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")

; Wait for Alert window, then click on OK

WinWait("Windows Internet Explorer", "ExampleFormSubmitted")

ControlClick("Windows Internet Explorer", "ExampleFormSubmitted", "[CLASS:Button; TEXT:OK; Instance:1;]")

_IELoadWait ($oIE)

; *******************************************************

; Example 1 - Open the AutoIt forum page, tab to the "View new posts"

; link and activate the link with the enter key.

; Then wait for the page load to complete before moving on.

; *******************************************************

;

#include <IE.au3>

$oIE = _IECreate ("http://www.autoitscript.com/forum/index.php")

Send("{TAB 12}")

Send("{ENTER}")

_IELoadWait ($oIE)

Share this post


Link to post
Share on other sites
MarcusHelo

anybody?

Share this post


Link to post
Share on other sites
exodius

So... What exactly are you trying to accomplish? Is there a specific webpage that you want to perform this on?

Better examples are the ones from _IEFormElementSetValue function that use actual webpages:

#include <IE.au3>
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://www.hotmail.com")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "your username here"
$password = "your password here"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")oÝ÷ Ù©Ýjëh×6#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

Share this post


Link to post
Share on other sites
MarcusHelo

What i am trying to accomplish, is 1 simple click on the script, and the script will open a webpage (not neccesary), fill in username and pass (pass from a list on where i keep track of all of my passwords) and log in.

Right now, the script only opens hotmail.com, but doesnt fill in anything (i filled in my pass and username on the right places in the script).

The second piece of code you added in your post, opens the word document with my passes and tries them? Or does it need to be a script, with the passes on each line?

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  

×