0

我希望打开一个 RogueWave HostAccess 会话,以便通过 SendKeys 函数实现自动化。下面列出了公司提供的代码,但运行代码时会打开终端仿真器的新窗口,但会在 GetObject() [第 2 行] 处冻结。

收到错误:Microsoft Excel 正在等待另一个应用程序完成 OLE 操作。运行时错误 429 - ActiveX 组件无法创建对象。

RogueWave 提供的代码:

Rem Define the variable HostAccess as the data type object.
Rem This represents the HostAccess application when used for
Rem OLE automation
Dim HostAccess
Rem Create an OLE object that corresponds to HostAccess.
Rem We will use this object to invoke
Rem published automation methods.
Set HostAccess = GetObject("", "Session.Setting")
Rem Start a session with the given name
result = HostAccess.LoadSession("TEST.SES", "", True)
Rem Once HostAccess has loaded, tell it to print something
Rem on the terminal window.
result = HostAccess.ScriptExec("print ""hello world""")
Rem Close the HostAccess session
HostAccess.EndSession
Rem Unload/Exit HostAccess
HostAccess.Unload

资料来源:http ://docs.roguewave.com/HostAccess/7.40j/HostAccessUserGuide.pdf

谢谢,

4

0 回答 0