You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IBM iSeries环境下VBScript读取字段报错:Refresh方法不被支持

Fixing "Object doesn't support this property or method: 'autECLSession.autECLPS.Refresh'" in PCOMM VBScript

Let’s dive straight into fixing your script error. The core issue here is that the autECLPS presentation space object in PCOMM doesn’t have a Refresh() method—this is a common mix-up with other automation tools. Let’s walk through the fixes step by step.

Step 1: Replace Refresh() with valid screen synchronization

Instead of trying to call Refresh(), use PCOMM’s built-in methods to sync your script with the host screen. The most reliable options are:

  • WaitForHostQuiet: Waits until the host stops sending data (ideal after sending keystrokes)
  • WaitForCursor: Waits for the cursor to be in a ready state
  • WaitForString: Waits for a specific text string to appear (great for verifying navigation)

For your workflow, replacing autECLSession.autECLPS.Refresh() with autECLSession.autECLPS.WaitForHostQuiet(3000, 1000) will resolve the immediate error. This waits up to 3 seconds for the host to quiet down, checking every 1 second.

Step 2: Fix the GetText() call (critical for accurate item number reading)

Your current IBMItemNum = autECLSession.autECLPS.GetText() is missing required parameters. The GetText() method needs explicit coordinates to know which part of the screen to read. You must specify the starting row, column, and length of the item number field.

For example, if your item number lives at row 8, column 12, and is 6 characters long, the call should look like:

IBMItemNum = autECLSession.autECLPS.GetText(8, 12, 6)

Use PCOMM’s "View > Presentation Space" tool to get the exact coordinates for your PO screen layout.

Revised MatchItemNum Subroutine

Here’s the corrected version of your subroutine with these fixes (plus a missing Loop statement that would have caused infinite execution):

sub MatchItemNum(ItemNum,Price)
    Do While IBMItemNum <> 0
        counter = counter + 1
        If counter > 11 Then
            autECLSession.autECLPS.SendKeys "[PGDN]" 'page down since bottom of lines reached
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]" 'tab to return to first line of PO
            counter = 0 'reset counter
        End if

        ' Replace invalid Refresh() with host synchronization
        autECLSession.autECLPS.WaitForHostQuiet(3000, 1000)
        
        ' Update GetText with your actual screen coordinates
        IBMItemNum = autECLSession.autECLPS.GetText(8, 12, 6) 

        If IBMItemNum = ItemNum Then 'If-Then statement once ItemNum is found
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys Price
            autECLSession.autECLPS.SendKeys "[field+]"
            autECLSession.autECLPS.SendKeys "[enter]"
            autECLSession.autECLPS.SendKeys "Y"
            autECLSession.autECLPS.SendKeys "[enter]"
            IBMItemNum = 0 'exit condition for loop
        Else 'Tab five times to reach next line
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
            autECLSession.autECLPS.SendKeys "[tab]"
        End if
    Loop ' Added missing Loop to close the Do While block
    autECLSession.autECLPS.SendKeys "[F3]"
end sub

Quick Additional Checks

  • Add a session connection validation right after SetConnectionByName to catch connection issues early:
    If Not autECLSession.IsConnected Then
        MsgBox "Session failed to connect!"
        Exit Sub
    End If
    
  • Test your GetText() coordinates independently to ensure you’re capturing the correct item number before relying on the loop logic.

内容的提问来源于stack exchange,提问作者Zhong Tian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:38:17