Jump to content

Quick Fix Help!


Sean78
 Share

Recommended Posts

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!

Link to comment
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

Link to comment
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!!

Link to comment
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....

Link to comment
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

Link to comment
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

Edited by 99ojo
Link to comment
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!!!

Link to comment
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

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
 Share

  • Recently Browsing   0 members

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