Jump to content

Com Objects problem


Recommended Posts

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?!

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

  • Moderators

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

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

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

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