Jump to content
Sign in to follow this  
cornernote

Scripting.Dictionary error - Variable must be of type "Object"

Recommended Posts

cornernote

When I try this on my PC it is fine, but when I try it on a XP VM it fails. The VM has xplite installed and fairly much everything is stripped off.

What does Scripting.Dictionary need in order to work?

$o = ObjCreate("Scripting.Dictionary")
$o.Add ("test", "Test")

test.au3 (2) : ==> Variable must be of type "Object".:
$o.Add ("test", "Test")
$o^ ERROR

Share this post


Link to post
Share on other sites
cornernote

same issue with System.Collections.ArrayList:

$o = ObjCreate("System.Collections.ArrayList"); create
$o.Add('test')

test.au3 (2) : ==> Variable must be of type "Object".:
$o.Add ('test')
$o^ ERROR

Share this post


Link to post
Share on other sites
BrettF

You must have those objects registered. Since you said its a lite version, then you probably don't.

Have you tried using a custom error handler?

For example:

$oIE=ObjCreate("InternetExplorer.Application.1")   ; Create Internet Explorer application

Global $g_eventerror = 0   ; to be checked to know if com error occurs. Must be reset after handling.

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")   ; Initialize a COM error handler

$oIE.UnknownMethod   ; Deliberately call an undefined method

If $g_eventerror then
    $g_eventerror = 0
  Msgbox (0,"AutoItCOM test","Test passed: We got an error number: " & @error)
Else
  Msgbox (0,"AutoItCOM test","Test failed!")
Endif

Exit

; This is my custom defined error handler
Func MyErrFunc()

  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"    & @CRLF  & @CRLF & _
             "err.description is: " & @TAB & $oMyError.description  & @CRLF & _
             "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "       & @TAB & hex($oMyError.number,8)  & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "   & @TAB & $oMyError.scriptline   & @CRLF & _
             "err.source is: "       & @TAB & $oMyError.source       & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile     & @CRLF & _
             "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
            
    Local $err = $oMyError.number
    If $err = 0 Then $err = -1
    
    $g_eventerror = $err ; to check for after this function returns
Endfunc

Cheers,

Brett

:D

Share this post


Link to post
Share on other sites
cornernote

You must have those objects registered. Since you said its a lite version, then you probably don't.

How do I register them? What files or installed programs or services do they depend on?

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  

×

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.