Sign in to follow this  
Followers 0
chachew

GUI button calling IE.au3 functions

3 posts in this topic

I have a script that opens IE and navigates to a page and performs certain tasks via IECreate. If i create a simple GUI button in Koda, when i click on that button how do i make it perform the IEcreate things that i have in the script. Im new to this so sorry for the dumb questions. I tried to put all of the IE.au3 functions into something like:

Func LoginScript()

$url = "http://www.mysite.com"

$IE = _IECreate($url)

$Form1 = _IEFormGetObjByName ($IE,"form1"); Name of the Login page

$Username = _IEFormElementGetObjByName ($Form1, "txtUsername"); Data that will be entered into the username field

$Password = _IEFormElementGetObjByName ($Form1, "txtPassword"); Data that will be entered into the password field

$Submit = _IEFormElementGetObjByName($Form1, "btnSubmit"); ID of the submit button

_IEFormElementSetValue ($Username, "username")

Sleep(1000)

_IEFormElementSetValue ($Password, "password")

Sleep(1000)

_IEAction($Submit, "click"); Must use _IEAction for javascript code

EndFunc

Once i declare that function how do i have the Button click call that process?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Uhmm... there's no GUI there. But if there were, you would just call LoginScript() when the button was clicked. If your GUI is in message mode and the button was $idButton, it would look like this:

Switch GuiGetMsg()
     Case $idButton
         LoginScript()
EndSwitch

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

PsaltyDS..That work perfectly..thanks much

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