我正在尝试从Windows服务中自动运行"Teststand“脚本。到目前为止,通过从命令提示符调用以下命令,我已经完成了自动化:
C:\Program Files (x86)\National Instruments\TestStand 2013\Bin>
SeqEdit.exe /runEntryPoint "Single Pass" "c:\Users\pathtofile\MyTests.seq" /quit我使用Python,所以我使用子流程模块实现了这一点。它打开、运行、保存结果并自行关闭。完美!但是,因为它启动了Teststand,所以它不能在Windows服务中工作。我甚至不需要这个GUI (因为我不接触它,并且结果存储在一个文件夹中),但是没有它,我似乎无法运行测试站。
我在使用CreateProcessAsUser()时使用了win32,但是我似乎什么都做不到。中有人能提供一种解决方案,使用上面的命令从Windows (windows 10)?运行一个测试站序列。
发布于 2018-10-26 08:53:52
On选项可以是使用TestStand API直接使用引擎运行序列。这是一个NI知识库中的示例
import win32com.client
tsEngine = win32com.client.Dispatch('TestStand.Engine.1')
print('TestStand %s.%s ready' % (tsEngine.MajorVersion, tsEngine.MinorVersion))
sequencePath = 'C:\\Users\\Desktop\\Sequence File 1.seq'
seqFile = tsEngine.GetSequenceFileEx(sequencePath)
execution = tsEngine.NewExecution(seqFile, "MainSequence", None, False, 0)
execution.WaitForEndEx(60000)
print(execution.ResultStatus)
tsEngine.ReleaseSequenceFileEx(seqFile, 0x4)通过使用它,我发现要彻底地结束它,我必须使用del来清除对execution和seqFile的引用,并处理UIMessages,以确保在执行结束时没有任何未完成的操作。
https://stackoverflow.com/questions/47023221
复制相似问题