charon Posted September 7, 2014 Share Posted September 7, 2014 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 Link to comment Share on other sites More sharing options...
Loken Posted September 8, 2014 Share Posted September 8, 2014 #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 Link to comment Share on other sites More sharing options...
Joon Posted September 8, 2014 Share Posted September 8, 2014 (edited) I know many of my IE scripts fail if it is not in 'Protected Mode'. Edited September 8, 2014 by Joon Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now