Skip to Content
0

Script sendo interrompido por janela de confirmação

Jul 14, 2017 at 03:21 PM

71

avatar image
Former Member

Olá, como vai?

Estou com um problema quando vou rodar o scripting SAP GUI, no meio do caminho aparece uma confirmação para alguns dos pedidos de compra, preciso que se aparecer o alerta, que aperte a opção "Sim" e continue a execução?

Exemplo do scripting usado

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]").resizeWorkingPane 141,13,false session.findById("wnd[0]/usr/ctxtCAUFVD-AUFNR").text = "500000004026" session.findById("wnd[0]/usr/ctxtCAUFVD-AUFNR").caretPosition = 12 session.findById("wnd[0]").sendVKey 7 session.findById("wnd[0]/usr/tabsTABSTRIP_2000/tabpPSPV").select session.findById("wnd[0]").sendVKey 71
session.findById("wnd[1]/usr/txtAFVGD-VORNR").text = "20tr" session.findById("wnd[1]/usr/txtAFVGD-VORNR").caretPosition = 4 session.findById("wnd[1]").sendVKey 0
session.findById("wnd[0]").sendVKey 9
session.findById("wnd[0]").sendVKey 13

AQUI PODE APERECER A CAIXA DE DIALOGO, SE APARECER USAR A OPÇÃO ABAIXO, CASO CONTRÁRIO SEGUIR O SCRIPTING

session.findById("wnd[1]/usr/btnOPTION2").press


session.findById("wnd[1]").sendVKey 6
session.findById("wnd[0]/usr/chkAFRUD-AUERU").selected = true session.findById("wnd[0]/usr/chkAFRUD-LEKNW").selected = true session.findById("wnd[0]/usr/chkAFRUD-IPRK1").selected = true session.findById("wnd[0]/usr/ctxtAFRUD-GRUND").text = "z4" session.findById("wnd[0]/usr/txtAFRUD-LTXA1").text = "n" session.findById("wnd[0]/usr/chkAFRUD-IPRK1").setFocus session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 11

Desde já obrigado

Bruno Marangoni

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Script Man Jul 17, 2017 at 07:17 AM
0

Olá Bruno,

você pode tentar o seguinte.

Por exemplo:

. . .

session.findById("wnd[0]").sendVKey 13

on error resume next

session.findById("wnd[1]/usr/btnOPTION2").press

on error goto 0

session.findById("wnd[1]").sendVKey 6

. . .

Atenciosamente,

ScriptMan

Share
10 |10000 characters needed characters left characters exceeded