【问题标题】:Different Script (SAP GUI) Codes for the same process in two different computers两台不同计算机中同一进程的不同脚本 (SAP GUI) 代码
【发布时间】:2017-08-02 19:35:07
【问题描述】:

我想为我的作品自动化一些操作,所以我在 SAP GUI(SAP LOGON PAD 720)上录制了一个脚本,然后用它来创建一个 excel 宏,它在我的计算机上完美运行,但是当我尝试运行它时在其他计算机中,它根本不起作用,当我在其他 PC 中记录相同的过程时,脚本的代码与我的 PC 中出现的代码不同。我想知道这怎么可能,我怎样才能在我的电脑上更改“代码形式”或“代码语言”,以便在我录制脚本时可以在每台计算机上使用它。

这是我电脑上的脚本

If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "vl03n"
session.findById("wnd[0]").sendVKey 0
'This is the script I recorded from my computer,in other pc this "LIKP-VBELN" doesnt appear
session.findById("wnd[0]/usr/ctxtLIKP-VBELN").text = "8105148724"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[7]").press

如果我从其他电脑上记录相同的过程

If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "vl03n"
session.findById("wnd[0]").sendVKey 0
'here is when the error begin "LIKP-VBELN" doesnt appear anymore so that is why the macro doesnt work
session.findById("wnd[0]/usr/ctxt").text = "8105148724"
session.findById("wnd[0]/usr/ctxt").caretPosition = 10
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[7]").press

【问题讨论】:

    标签: macros sap-gui


    【解决方案1】:

    检查客户端的 LAN 连接并确保其设置为高速。

    问候, 脚本人

    【讨论】:

    • 嗨,我该怎么做?是来自 SAP 吗?当我说“其他计算机”时,我必须说那是坐在我旁边的任何同事的计算机。
    • 谷歌:SAP LAN 连接高速 ;-)
    • 我在谷歌上搜索它,但在我的电脑中无法按照该步骤操作,找不到相同的屏幕,无论如何,我开发了另一个可以在其他电脑上完美运行的宏。谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多