Sean78 Posted February 24, 2010 Posted February 24, 2010 Hello All, I need some urgent help I have five locations that use a script that w/ the help of you fine people I was able to compile to automatically login to a website for our users. Well all of the sudden it has stopped working. The following Error Message appears: AutoIT Error Line -1: Error: Variable must be of type "object". I am not a good script writer and I am sure something has changed on the site for this error to occur but I cannot figure out how to fix this. I believe the correct script that was working was this: #include Local $oUser, $oPass, $oSubmit Local $sUser = "test" Local $sPass = "test" Local $url = "https://secure.williams-int.com/.asp" Local $oIE = _IECreate($url, 1) _IELoadWait($oIE) $oInputs = _IETagNameGetCollection($oIE, "input") for $oInput in $oInputs if $oInput.type = "text" And $oInput.name = "userid" And $oInput.size = "12" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "password" And $oInput.size = "12" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.value = " SIGN IN " Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next $oUser.value = $sUser $oPass.value = $sPass _IEAction($oSubmit, "click") _IELoadWait($oIE) If anyone can help me on this it would be much appreciated as I have been looking at it off and on for a couple days now and there must be some simple change that is needed but I don't know what it is. PLEASE HELP!
99ojo Posted February 24, 2010 Posted February 24, 2010 Hi, Local $url = "https://secure.williams-int.com/.asp" If you put this url in your browser you get an HTTP Error 404. If you put https://secure.williams-int.com as url you will redirect to https://secure.williams-int.com/customers/login.asp. This might helps you.... ;-)) Stefan
Sean78 Posted February 24, 2010 Author Posted February 24, 2010 Hi,Local $url = "https://secure.williams-int.com/.asp"If you put this url in your browser you get an HTTP Error 404.If you put https://secure.williams-int.com as url you will redirect to https://secure.williams-int.com/customers/login.asp.This might helps you....;-))StefanStefan thanks for the fast response, my final script actually did have the correct url in it. Here is the actual script that was working until Monday:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script.#ce ----------------------------------------------------------------------------; Script Start - Add your code below here#include <IE.au3>Local $oUser, $oPass, $oSubmitLocal $sUser = "test"Local $sPass = "test"Local $url = "https://secure.williams-int.com/customers/login.asp"Local $oIE = _IECreate($url, 1)_IELoadWait($oIE)$oInputs = _IETagNameGetCollection($oIE, "input")for $oInput in $oInputs if $oInput.type = "text" And $oInput.name = "userid" And $oInput.size = "12" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "password" And $oInput.size = "12" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.value = " SIGN IN " Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloopNext$oUser.value = $sUser$oPass.value = $sPass_IEAction($oSubmit, "click")_IELoadWait($oIE)It is really annoying me trying to figure out what this error is!!
Sean78 Posted February 24, 2010 Author Posted February 24, 2010 Okay in a rush I just double clicked the script file (non-converted to .exe) it ran, and now I am seeing the following error come up: Line 30 $oUser.value=$sUser $oUser^ERROR Error: Variable must be of type "Object". Still not sure what that means....
99ojo Posted February 24, 2010 Posted February 24, 2010 Hi, if you change your For Loop like this: for $oInput in $oInputs ConsoleWrite ("Type: " & $oInput.type & " Name: " & $oInput.name & " Size: " & $oInput.size & @CRLF) if $oInput.type = "text" And $oInput.name = "userid" And $oInput.size = "12" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "password" And $oInput.size = "12" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.value = " SIGN IN " Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next you will see, that the Size is 16. I changed your 12 to 16 and the fileds user and password are filled. ;-)) Stefan
Sean78 Posted February 24, 2010 Author Posted February 24, 2010 So changing it from 12 to 16 fixes it? How did you figure that out exactly???
99ojo Posted February 24, 2010 Posted February 24, 2010 (edited) Hi, see ConsoleWrite in For Loop. It shows for the size 16. So next step was, for christ sake, he has an if statement for $oInput.size = "12" in his code? So i just changed 12 to 16 and the fields are filled...... ;-)) Stefan Edited February 24, 2010 by 99ojo
Sean78 Posted February 24, 2010 Author Posted February 24, 2010 Hi,see ConsoleWrite in For Loop. It shows for the size 16. So next step was, for christ sake, he has an if statement for $oInput.size = "12" in his code? So i just changed 12 to 16 and the fields are filled......;-))StefanSorry Stefan, I was just amazed how simple that fix was, I do not know what ConsoleWrite is, but I will now go figure that out. Script had been working since October 2009 using 12, but I guess the company changed their website.....go figure, what a silly change to make. You sir are a credit to AutoIT forums!!!
99ojo Posted February 24, 2010 Posted February 24, 2010 Sorry Stefan, I was just amazed how simple that fix was, I do not know what ConsoleWrite is, but I will now go figure that out. Script had been working since October 2009 using 12, but I guess the company changed their website.....go figure, what a silly change to make. You sir are a credit to AutoIT forums!!!Hi,don't use ConsoleWite in your compiled code, you don't need it. If you use ConsoleWrite in au3 file, it writes the output in the message window of SCite Editor, so you can control variables (as i did).;-))Stefan
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