Jump to content

set user & pw in website


Recommended Posts

hello guys,

i used this function 2 times, and it works fine on both. now, if i want to use it again, there might be a problem.

i want to attach an existing ie-window (no problem). after this i want to set my username & pw in the 2 boxes.

thats my normal, old script ...

$oIE = _IEAttach("Portal")
$oForm = _IEFormGetCollection ($oIE, 0)
$oUsername = _IEFormElementGetObjByName ($oForm, "htmlb_1269_htmlb_239_1")
$oPassword = _IEFormElementGetObjByName ($oForm, "htmlb_1269_htmlb_239_2")
_IEFormElementSetValue ($oUsername, "user")
_IEFormElementSetValue ($oPassword, "pw")
_IEFormSubmit ($oForm, 0)

but the names of "htmlb_1269_htmlb_239_1" will be changed every time. so what can i do?

somebody told me, that i can use the form name?

but what to do when i did this $oForm = _IEFormGetObjByName ( $oIE, "DSMSender11faef3e53964ee94b89fd13901816b5" ) ?

here you will find the code of this site >>> http://www.autoit.de/attachment.php?attachmentid=1175

Edited by sc4ry
Link to comment
Share on other sites

Sounds like you could use _IEFormElementGetCollection.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

i try this, but it doesn´t work either

--> IE.au3 Warning from function _IEFormGetCollection, $_IEStatus_NoMatch

how to include IEFormElementGetCollection? i´m a html noob =/

#include <ie.au3>
$iForm_index=0
$iUserID_index = 20
$iPasswd_index = 21
 
$oIE = _IEAttach("Portal")
if isObj($oIE)then
    $oForm = _IEFormGetCollection ( $oIE, $iForm_index)
    if isObj($oForm) Then
        $oUsername = _IEFormElementGetCollection($oForm, $iUserID_index)
        $oPassword = _IEFormElementGetCollection($oForm, $iPasswd_index)
        _IEFormElementSetValue ($oUsername, "user")
        _IEFormElementSetValue ($oPassword, "pw")
        _IEFormSubmit ($oForm,0)
    Endif
Endif
Link to comment
Share on other sites

You've included the *GetCollection functions correctly. The error you are getting means that a form is not being found at the location you specify. However, when I run your script on the sample source you provided, it works fine...

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
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...