Jump to content

_IEGetObjByName works at home not at work


Recommended Posts

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

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



Link to comment
Share on other sites

#include <IE.au3>
$Username = 'username'
$Password = 'password'
$Login = 'url'
$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")
$Index = $Index + 1

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...