Jump to content

ObjCreate failing on some COM objects


Recommended Posts

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
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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