Sign in to follow this  
Followers 0
Sean78

Quick Fix Help!

9 posts in this topic

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!

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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

Stefan 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, $oSubmit

Local $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 exitloop

Next

$oUser.value = $sUser

$oPass.value = $sPass

_IEAction($oSubmit, "click")

_IELoadWait($oIE)

It is really annoying me trying to figure out what this error is!!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

So changing it from 12 to 16 fixes it? How did you figure that out exactly???

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by 99ojo

Share this post


Link to post
Share on other sites

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

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!!!

Share this post


Link to post
Share on other sites

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

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  
Followers 0