Jump to content

Need help with IE Login!


Fr3shY
 Share

Recommended Posts

Hi.

I'm looking to login using the help of the IE UDF. I've just about spent 2 hrs looking through the help files, but I can't seem to get it. I've searched the forums for examples, anything I could find and tried taking it apart, but this is really giving me a hard time.

Here is a snippet of the code:

;includes
#include <GUIConstants.au3>
#include <Constants.au3>
#include <IE.au3>

;options
Opt("TrayIconHide", 0)
Opt("GuiOnEventMode", 1)

;vars
$username = IniRead(@ScriptDir & "\login.ini", "Login", "username", "Please enter your username into the .ini file!")
$password = IniRead(@ScriptDir & "\login.ini", "Login", "password", "Please enter your password into the .ini file!")

;embedded browser
$CBTask = _IECreateEmbedded()
GUICreate("ChatBox App", 1200, 300)
$CBGUI = GUICtrlCreateObj($CBTask, -15, -255, 1250, 1024)
GUISetState()
_IENavigate ($CBTask, "http://cheatingnetwork.net/forums/chatbox.html", 0)

;login method
Sleep(2500)
$o_form = _IEFormGetObjByName ($CBTask, 2)
$o_login = _IEFormElementGetObjByName ($o_form, "vb_login_username")
$o_password = _IEFormElementGetObjByName ($o_form, "vb_login_password")
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
Send("{ENTER}")

;while
While 1
    $CBGUI = GUIGetMsg()
    Select
    Case $CBGUI = $GUI_EVENT_CLOSE
        Exit
    EndSelect
WEnd

I know I want to get the entire login procedure controlled via the IE UDF. I know it's possible and in my code is what I've gotten too, of course it doesn't work (the IE login). I figured the other stuff out, it's just this _IEForm* stuff that is throwing me off. I know there is a way to have _IEFormSubmit or _IEFormImageClick something like that click the login instead of using just send enter, but it's good for now and it works. I already have this app completed, but it is really locked down considering it only allowed operation with a certain resolution and that's not convenient or not possible for a lot of the other members. I want to make this so that the UDF does it instead of clicking on the login box, then using Send $username ect, ect.

Oh yeah, some errors:

--> IE.au3 V2.4-0 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch

^^ Obviously put, it can't find the fields for username/password. I just have to get down this whole name thing. ^^

If you could shed some light on this, it would help a ton. This is a chatbox app and it takes you to: http://cheatingnetwork.net/forums/chatbox.html

That is when you launch this app... pretty much it takes you to a login page which then redirects you to the chatbox... pretty straight forward.

Please feel free to check out the source to the login or do whatever you need to!

Thanks.

~Fr3shY

Edited by Fr3shY
Link to comment
Share on other sites

There is something odd on that page. It looks like there are only 5 forms, but the DOM sees 7. The one you want is index 4, not 2.

Malformed HTML can sometimes confuse the DOM.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

There is something odd on that page. It looks like there are only 5 forms, but the DOM sees 7. The one you want is index 4, not 2.

Malformed HTML can sometimes confuse the DOM.

Dale

Wow Dale, you're amazing. It works fine now! I can usually figure out most of my scripting help using the docs, but I'm confused on how you figured that out. If you could explain how to choose which form is which, it would be of great help!

Thanks,

Fr3shY

EDIT: Saw the link to the IE Builder, thanks a bunch! I'm off to making a silent bot now!

Edited by Fr3shY
Link to comment
Share on other sites

$oForms = _IEFormsGetCollection($oIE)
ConsoleWrite("Forms found: " & @extended & @CR)
For $oForm in $oForms
    ConsoleWrite(_IEPropertyGet($oForm, "outerhtml") & @CR & "-------------" & @CR)
Next

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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