Jump to content
Sign in to follow this  
charon

_IEGetObjByName works at home not at work

Recommended Posts

charon

I made a script to log into a client side form which works fine at home when I test it but doesn't work at all at work. I tested at home in IE8 which is what my work computer uses. Is there some security setting in IE8 that would prevent _IEGetObjByName from working?   I even made a simple client side web form to test my AutoIt program with which works at home but not at work.  The error is 3 ($_IEStatus_InvalidDataType) - Invalid Data Type

Func SignIn($fname)
;fname is just a html form on my computer to test with: form.html. the below code is not populating the form
$POD = getPOD($fname)
Global $oIE = _IECreate(@ScriptDir & "\" & $fname, 0 ,1, 1)   ;for work
    If $fname = "D3.html" Then
        logFile("Function SignIn: Found D3 type: " & $fname, "log.txt")
        Local $user = _IEGetObjByName($oIE, "user")
        Local $pass = _IEGetObjByName($oIE, "pws")
        Local $button = _IEGetObjById ($oIE, "goo")   ;had to add id to form
        If @error Then
            MsgBox(0, "", "Error in function SignIn ...Error code: " & @error & "Exiting...")
        EndIf
                

    _IEFormElementSetValue ($user, "test")   ;not working??
    _IEFormElementSetValue ($pass, $POD)   ;not working??
    If @error Then
            MsgBox(0, "", "Error in function ...Error code: " & @error & "Exiting...")
        EndIf
        ;msgbox(0,'','POD: ' & $user & ' is ' & $POD, 2)
    _IEAction ($button, "click")
         _IELinkClickByText($oIE, "Admin")
EndFunc

 

 

Share this post


Link to post
Share on other sites
Loken

#include <IE.au3>
$Username = 'username'
$Password = 'password'
$Login = 'url'
_IENavigate($oIE,$Login,1)
$Index = 0
While 1
$oForm = _IEFormGetCollection ($oIE,$Index)
$oQuery = _IEFormElementGetObjByName ($oForm, "user")
IF  @extended  Then
_IEFormElementSetValue ($oQuery,$Username)
$oQuery = _IEFormElementGetObjByName ($oForm, "pws")
_IEFormElementSetValue ($oQuery,$Password)
;;;
$oLinks = _IETagNameGetCollection($oIE, "input")
For $oLink In $oLinks
    If String($oLink.type) = "submit" And String($oLink.value) = "goo" Then
          _IEAction($oLink, "click")
          _IELoadWait($oIE)
          ExitLoop
    EndIf
Next
;;;
ExitLoop
EndIf
$Index = $Index + 1
Sleep(25)
WEnd

I think it is simple code to understand and start learning IE udf

Share this post


Link to post
Share on other sites
Joon

I know many of my IE scripts fail if it is not in 'Protected Mode'.

Edited by Joon

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  

×