Jump to content
AJB

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

Recommended Posts

AJB

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.

Share this post


Link to post
Share on other sites
JLogan3o13

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


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
seeker0718

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

Share this post


Link to post
Share on other sites
Melba23

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

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

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

  • Similar Content

    • SkysLastChance
      By SkysLastChance
       
      WinActivate("MEDITECH - Internet Explorer") Sleep (500) $oIE = _IEAttach("MEDITECH") $oDiv1 = _IEGetObjById($oIE, "sysmenu-searchbarbutton") _IEAction($oDiv1, "click") I am just trying to click the little magnifying glass, next to the gear button with no luck. I was hoping someone might have an idea why this is not working?
       

    • SkysLastChance
      By SkysLastChance
      I am trying to type a name in patient summary search box. How should I go about doing this. I am clearly not doing it right. (Attached Picture of HTML code.)
      This is what I have tried. I assume this is not working because it is not a form? 
      WinActivate("MEDITECH - Internet Explorer")       Sleep (500)    $oIE = _IEAttach("MEDITECH")    $oForm = _IEFormGetObjByName($oIE, "systemMenu")    $oText = _IEFormElementGetObjByName($oForm, "sysmenu-searchbarinput") _IEFormElementSetValue($oText, "Hey! This works!")
    • therks
      By therks
      Has anybody else noticed that Windows 7 reacts ignorantly when you use the Windows key + arrow key shortcuts on a GUI with GUIEventMode set to 1? I discovered this recently when I was working on an app where I wanted complete control over the maximize/minimize buttons.
      Just give it a spin:
      #include <GUIConstants.au3> Opt('GUIEventOptions', 1) $hGUI = GUICreate('', 300, 200, Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_MAXIMIZE ToolTip('Maximized') Case $GUI_EVENT_MINIMIZE ToolTip('Minimized') Case $GUI_EVENT_RESTORE ToolTip('Restored') Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Run that, then hit Win+Up or Win+Down. None of those events get triggered, and it still maximizes/minimizes. Although I can't get it to restore down from a maximize unless the window is also resizable ($WS_THICKFRAME in the style).
      Is there a way to stop Windows from doing what it wants or is the only option to check with WinGetState() and then change it back?
       
      Windows 10 seems to respect my settings, and I don't have any other versions to test on.
    • aiter
      By aiter
      Just want to report a warning I get when using IE udf and running from F5 in scite

      -> IE.au3 T3.0-2 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
      When I look at IE.au3 I see a comment that this function has been removed as there are no more fatal errors.
       
    • aiter
      By aiter
      I created a webpage using the IE udf. Great, but then I noticed I cannot do a ctrl-F to find something on the page. 
      If I save the page then bring that page up I can find things of course.
      Its trivial really, but is there way to get the ctrl-F to work when the page is generated without resorting to having to save?
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.