在工作中,我必须使用IBM i Access Client Solutions从AS400屏幕提取数据。
我曾经有可以与PComm一起使用的代码;但是,他们最近(无需询问)替换了我公司的软件,这导致最多几天的延迟。
这是我的旧代码:
Option Explicit
Sub JDE()
' Uses Microsoft forms 2.0 object libraries as references
' You must have Pcomm from IBM installed for this to work:
' https://www.ibm.com/us-en/marketplace/personal-communications
Dim autECLSession, autECLOIA, autECLPS, autECLConnList As Object
Dim JDE, Enter, Load, F1, F2, F3, F4, F5, ShF4, PageDown, PageUp, Clear As String
Set autECLSession = CreateObject("Pcomm.autECLSession")
Set autECLOIA = CreateObject("Pcomm.autECLOIA")
Set autECLPS = CreateObject("Pcomm.autECLPS")
Set autECLConnList = CreateObject("PCOMM.autECLConnList")
autECLSession.SetConnectionByName "A"
Set JDE = autECLSession.autECLPS
Set Load = autECLSession.autECLOIA
Enter = "[enter]"
F1 = "[pf1]"
F2 = "[pf2]"
F3 = "[pf3]"
F4 = "[pf4]"
F5 = "[pf5]"
ShF4 = "[pf15]"
PageDown = "[Roll up]"
PageUp = "[Roll down]"
Clear = "[erase eof]"
' Extracting text
Selection= JDE.GetText (10, 64, 10(spaces required))
' Navigating JDE
Load.waitforappavailable
Load.WaitForInputReady
JDE.SendKeys F1
JDE.SendKeys F2
JDE.SendKeys F3
JDE.SendKeys F4
JDE.SendKeys ShF4
JDE.SendKeys Clear
JDE.SendKeys PageDown
JDE.SendKeys PageUp
End Sub
上面的示例通过发送几次击键并提取一些文本到内存来帮助我浏览屏幕。