Jump to content

"Error: Variable must be of type object" on new machine


Recommended Posts

Hello,

I've been using autoit for about a year now and overall it's been great despite my limited understanding of all of its features. I have several scripts that run on virtual machines that have been running smoothly for several months without any issues. Recently, I had to create new virtual machines and migrate my scripts over and now I am getting errors that I can't seem to repeat, but seem to happen at least once a day with all of my executables that were flawless before.

The error that I keep getting is:

Autoit Error

Line [this number varies per script] (File "[path to my executable]"); Error: variable must be of type object.

I  never received this error before until I moved everything to the new VMs, and when I rerun my scripts after clearing the error everything seems to work and run fine until hours later or sometimes the next day. I am assuming that that the root cause may be in some kind of settings on the VM itself since it is happening nearly across the board, but I have no idea where to even look. These are running on Windows 7, which is what they were running on before I had any errors.

The only consistent include used in these scripts is  IE.au3

Has anyone run into a similar problem or can maybe point me in the right direction. I am at the point of pulling hair out trying to resolve this. I have even rewritten and re-compiled the scripts to see if somehow the executables got corrupted, but that didn't help.

Thank you.

Link to comment
Share on other sites

  • Moderators

@AJB the error is telling you exactly what is wrong - you're calling a variable that is not an object. Unfortunately, more than that is impossible if you do not post your script.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • 5 months later...

Hello,

 I have a similar problem but I received this error when moved from Windows 7 / IE7 / 32bit to Windows 7 / IE11 / 64 bit machine.

The script selects one of  4 dropdown options in the loop and randomly the third or fourth gets this error when in FireBug you can see all of them and if

_IEFormElementOptionSelect() is not called, Console write will print all of them

Here is the code:

$oForm = _IEFormGetObjByName($oIE, "myform")
$tp = _IEFormElementGetObjByName($oForm, "target")
If @error = "0" Then
    $cc = 0
    _IEAction($tp, "focus")
    For $t In $tp
        $cc = $cc + 1
        ConsoleWrite("count: " & $cc & @CRLF)


        If $cc = 1 Then
            ConsoleWrite(_IEPropertyGet($t, "outerhtml") & @CRLF)
            ConsoleWrite("innerText: " & $t.innerText & @CRLF)
            ;If ($t.innerText) <> "" Then
            ConsoleWrite("innerText: " & $t.innerText & @CRLF)
            _IEFormElementOptionSelect($tp, "Coldstore", 1, "byText")
            ;EndIf
            Sleep(1000)
        ElseIf $cc = 2 Then
            ConsoleWrite(_IEPropertyGet($t, "outerhtml") & @CRLF)
            ConsoleWrite("innerText: " & $t.innerText & @CRLF)
            ;If ($t.innerText) <> "" Then
            ConsoleWrite("innerText: " & $t.innerText & @CRLF)
            _IEFormElementOptionSelect($tp, "Windows File Share/SMB", 1, "byText")
            ;EndIf
            Sleep(1000)
        ElseIf $cc = 3 Then
            ConsoleWrite(_IEPropertyGet($t, "outerhtml") & @CRLF)
            ConsoleWrite("innerText: " & $t.innerText & @CRLF)
            ;If ($t.innerText) <> "" Then
            ConsoleWrite("innerText: " & $t.innerText & @CRLF)
            _IEFormElementOptionSelect($tp, "Internal SD card", 1, "byText")
            ;EndIf
            Sleep(1000)
        ElseIf $cc = 4 Then
            ConsoleWrite(_IEPropertyGet($t, "outerhtml") & @CRLF)
            ConsoleWrite("innerText: " & $t.innerText & @CRLF)
            ;If $t.innerText <> "" Then
            ConsoleWrite("innerText: " & $t.innerText & @CRLF)
            _IEFormElementOptionSelect($tp, "none", 1, "byText")
            ;EndIf

        EndIf
    Next
EndIf

Output:

count: 1
<option value="coldstore">Coldstore
innerText: Coldstore
innerText: Coldstore
count: 2
--> IE.au3 T3.0-1 Error from function _IEPropertyGet, $_IESTATUS_InvalidObjectType
0
innerText:
innerText:
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (1115) : ==> Variable must be of type "Object".:
For $oItem In $oItems
For $oItem In $oItems^ ERROR

You can see that I commented check for an empty string.

If I uncomment it, I won't receive the error "Variable must be of type "Object".:" but I won't be able to select all options in loop in the dropdown.

The output will be with the 2 options available and 2 empty strings:

count: 1
<option value="coldstore" selected="">Coldstore
innerText: Coldstore
innerText: Coldstore
count: 2
<option value="wfs">Windows File Share/SMB
innerText: Windows File Share/SMB
innerText: Windows File Share/SMB
count: 3
--> IE.au3 T3.0-1 Error from function _IEPropertyGet, $_IESTATUS_InvalidObjectType
0
innerText:
count: 4
--> IE.au3 T3.0-1 Error from function _IEPropertyGet, $_IESTATUS_InvalidObjectType
0
innerText:

Any help will be appreciated!!!!!!

Edited by Melba23
Added code tags
Link to comment
Share on other sites

  • Moderators

seeker0718,

Welcome to the AutoIt forums.

When you post code please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

×
×
  • Create New...