2017-08-02 65 views
0

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

这是脚本从我的电脑

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 

回答

0

检查客户端的网络连接,并确保其设置为高速度。

Regards, ScriptMan

+0

嗨,我该怎么做?它来自SAP吗?当我说“其他电脑”时,我必须说这是我同事的电脑,他们坐在我旁边。 – user8366198

+0

谷歌:SAP LAN连接高速;-) – ScriptMan

+0

我搜索一下它在谷歌,但couldn't跟随在我的电脑的步骤,找不到的同一画面,无论如何,我开发出运行在其他电脑的完美另一个宏。谢谢。 – user8366198

相关问题