AnsweredAssumed Answered

Python COM automated

Question asked by dochang on Mar 18, 2014
Latest reply on Apr 1, 2014 by dochang
Dear professor,

I have successfully connected to my Logic Analyzer, 16901A via Python COM remote control. I am able to load the configure file to my LA and let it run or stop. But I meet some issues when I cast to some specific modules or call constants, such as AgtDataLong.

when I call “win32com.client.constants.AgtDataLong”, there will be AttributeError, which means ‘AgtDataLong’ is not defined. Because ‘AgtDataLong’ is their own data constant type, I doubt there should be something installed at first, as well as I get error track information when running the command “LAAnalyzerModule = win32com.client.CastTo(LAModule, "IAnalyzerModule")”, the error information is attached.

######################## My Code #####################################
import win32com.client

LAHostNameOrIP =  '135.24.17.88‘
LAConnect = win32com.client.Dispatch("AgtLA.Connect")
LAInst = LAConnect.GetInstrument(LAHostNameOrIP)
LAModule = LAInst.GetModuleByName("My 16950B-1")
print LAModule.Type

LAInst.Open("OOO.ala")

#if LAModule.Type == "Analyzer":
#   LAAnalyzerModule = win32com.client.CastTo(LAModule, "IAnalyzerModule")
#   LAAnalyzerModule.SimpleTrigger("My Bus 1=hff")

LAInst.Run()

LABusSignals = LAModule.BusSignals
LABusSignalsCount = LABusSignals.Count
LABusSignalNameArray = []
LABusSignalTypeArray = []

for index in range(LABusSignalsCount):
    LABusSignalName = LABusSignals.Item(index).Name
    LABusSignalType = LABusSignals.Item(index).BusSignalType
    LABusSignalNameArray.append(LABusSignalName)
    LABusSignalTypeArray.append(LABusSignalType)

    print LABusSignalName,LABusSignalType

###Get the module's bus/signal data and store into 'LADataArrays'.
LADataArrays = []
LADataArrays.append(LABusSignalNameArray)
LADataArrays.append(LABusSignalTypeArray)
LAStartRange = -10
LAEndRange = 10

for index in range(LABusSignalsCount):
    LAData = LABusSignals.Item(index).BusSignalData
    LABusSignalType = LABusSignalTypeArray[index]
    LADataType = win32com.client.constants.AgtDataLong
    .....
    .....
#######################################################

Edited by: dochang on Mar 18, 2014 10:55 PM

Edited by: dochang on Mar 18, 2014 10:56 PM  

Attachments

Outcomes