两台不同计算机中同一进程的不同脚本(SAP GUI)代码

Different Script (SAP GUI) Codes for the same process in two different computers

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

这是我电脑上的脚本

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

这是如果我从其他 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
'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

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

此致, 脚本人