Sign in to follow this  
Followers 0
zigggo

Com Objects problem

7 posts in this topic

Hi. I have the following code in my AutoIt script:

$app = ObjCreate("LeCroy.XStreamDSO")
if @error Then
msgbox(0,"error","Could Not Create XStreamDSO Object")
EndIf
$IDN = $app.InstrumentID
MsgBox(0,"",$IDN)

I was pretty sure that this was working until a day ago, but now $IDN is an empty string.

I do nearly the same code in vbscript:

set app = CreateObject("LeCroy.XStreamDSO")
IDN = app.InstrumentID
msgbox IDN

and IDN contains the correct text. What gives?!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

One thing, to check to see if ObjCreate was successful, check IsObj($app)

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

One thing, to check to see if ObjCreate was successful, check IsObj($app)

Dale

Yes, it is succesful. Also, there are a couple methods that do work, but most do not :( All of them work in the vbscript. I don't get it, and I was pretty sure it was all working just yesterday.

Share this post


Link to post
Share on other sites

Out of curiosity, what do you get if, for your Msgbox, you just do this?

MsgBox(0, "", $app.InstrumentID)

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

Share this post


Link to post
Share on other sites

Out of curiosity, what do you get if, for your Msgbox, you just do this?

MsgBox(0, "", $app.InstrumentID)

I get an empty string. If I do $app.InstrumentID.Value it returns an actual value! I am not sure what I could use for a method? Again, I could've sworn this was working just the other day without needing to do this.. I don't get what happened.

Share this post


Link to post
Share on other sites

You need a COM error handler which gives you detailed information about the error. Please check "ObjEvent" to see how it is being done.


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

if $app.InstrumentID is a method then try using $app.InstrumentID() instead.


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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