Sign in to follow this  
Followers 0
fritsbrasmussen

ObjCreate failing on some COM objects

6 posts in this topic

#1 ·  Posted (edited)

Trying to access Agilent VISA-COM object(s) with this code:

$oRM = ObjCreate("VISA.GlobalRM")
;$oRM = ObjCreate("shell.application") ; OK
;$oRM = ObjCreate("IVIConfigServer.IVIDriverSession") ; OK
;$oRM = ObjCreate("AgilentRM.SRMCls")
;$oRM = ObjCreate("AgM918x.AgM918x")
;$oRM = ObjCreate("AgilentGPIB.GpibSvr")
Msgbox(0,"RM", "Obj: " & IsObj($oRM) & "  Err: " & @error)

$oINSTR = ObjCreate("VISA.BasicFormattedIO")
Msgbox(0,"INSTR", "Obj: " & IsObj($oINSTR) & "  Err: " & @error)

$oINSTR.IO = ObjCreate($oRM.Open("GPIB0::22"))
Msgbox(0, "IO", "IO: " & IsObj($oINSTR.IO) & "  Err: " & @error)

I get

IsObj($oRM) = 0 and & @error = 0

IsObj($oINSTR) = 0 and  @error = 0

$oINSTR.IO = ObjCreate($oRM.Open("GPIB0::22")) generates this AutoIt error

$oINSTR^ERROR

Error: Variable must be of type "Object"

so apparently oRM and oINSTR are not objects.

When I view the Agilent Visa COM object(s) with OLE/COM viewer there is no reference to a Typelib.

Could this be the cause, and if so is the any way to circumvent?
 

Thanks for any help

Frits B Rasmussen

Edited by fritsbrasmussen

Share this post


Link to post
Share on other sites



To get detailed information about COM errors I suggest to add a COM error handler.

Please check the help file for ObjEvent.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks MVP,

First error reported by errorhandler is: 0x80004002 'No such interface supported'

I am afraid this still leaves me in the dark not being an expert on COM objects.

I got a Visual C# recipe:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Ivi.Visa.Interop;

namespace TG1B1A_VISA_demo

{

class Program

{

static void Main(string[] args)

{

// resource manager and message-based session manager

ResourceManager rMgr = new ResourceManagerClass();

FormattedIO488 src = new FormattedIO488Class();

FormattedIO488 BERT = new FormattedIO488Class();

(end of code excerpt)

Can this in any way be translated to AutoIt?

Regards

Frits B Rasmussen

Share this post


Link to post
Share on other sites

The help file describes that AutoIt version 3.3.8.1 only supports the IDispatch interface.

"AutoIt uses the IDispatch interface for automation. This interface 'exposes' all scriptable methods and properties that the object supports. If it does not exist, you can't use the object in an AutoIt script."

A lot of things have changed with the latest beta. But unvortunately I'm not too familiar with COM.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

From VPP-4.3.4 Visa Implementation Specification for COM it appears that IUnknown interface is needed,

so this is about as far as I get I suppose.

Thanks for your assistance.

Frits

Share this post


Link to post
Share on other sites

The latest beta has a new feature to implement interfaces: ObjCreateInterface.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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