DarkOnyx

Opening up multiple IE Tabs for a login script

4 posts in this topic

#1 ·  Posted (edited)

Hi Folks, I was wondering if someone could give me a hand with something.  Perhaps I am misunderstanding something.  I am trying to do a login window multiple times in IE.  I am using the IEEx.au3 library and it looks something like this:
 

-----------------------------------------------------------------------------------------------------------------

#include <IE.au3>

#include <IEEx.au3>

Global $oIE = _IECreate("https://somewebsitehere", 1)


Local $username = _IEGetObjByName ($oIE, "username")
Local $password = _IEGetObjByName ($oIE, "password")
Local $button = _IEGetObjByName ($oIE, "login")
_IEFormElementSetValue ($username,"whatever username")
_IEFormElementSetValue ($password,"whatever password")

_IEAction ($button, "click")





Global $goTab = _ExampleTabCreate($oIE)
ConsoleWrite(@error & ":" & @extended & ": IsObj = " & IsObj($goTab) & @CRLF)

_IEQuit($goIE)

Func _ExampleTabCreate(ByRef $oObj)  ; THIS IS WHAT IS CAUSING THE TROUBLE!!!

    If Not IsObj($oObj) Then
        Return SetError(1, 0, 0)
    EndIf



; Second website

    Local $oTab = _IEEx_TabCreate($oObj, "https://somewebsitehere")

 Local $username = _IEGetObjByName ($oTab, "username")
Local $password = _IEGetObjByName ($oTab, "password") 
Local $button = _IEGetObjByName ($oTab, "login")
_IEFormElementSetValue ($username,"whatever username")
_IEFormElementSetValue ($password,"whatever password")
_IEAction ($button, "click")


------------------------------------------------------------------------------------------------------

So this works, but I have two main problems.

Most importantly, I want to use this in a function.  The problem is, that line "Func _ExampleTabCreate(ByRef $oObj) " prevents that from happening.  SciTe essentially thinks that I am defining a function inside of defining a function and it yells at me.  It won't run without it.



Secondly, that IEAction "click" never worked for me.  It will propogate the fields correctly based on the name in the source... it just won't submit the form.



Any ideas here?  

Edited by JLogan3o13

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

@DarkOnyx, you are specifying Func _ExampleTabCreate(), but I see no EndFunc to close it out. Also, in the future, please place your code inside a code box, it makes it so much easier to read.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Sure thing.  And thanks for the response.

The problem is, it still doesn't work when I use and endfunc.  It works fine as written for some reason.  Very bizarre.  I think that the formatting doesn't work for some reason.
I think that defining a function inside of defining a function is what trips it up.
 

It doesn't seem to like this format:

Func Dosomestuff()
     Func Dootherstuff()
Endfunc
Endfunc

 

Share this post


Link to post
Share on other sites

You are correct that AutoIt does not allow for nested functions. I only see the one function you reference, however. Can you please post the entirety of you code so we can see what you're trying to do?


√-1 2^3 ∑ π, and it was delicious!

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