I've been searching for an answer for this, but without success...
I have a few scripts that need to show exactly wich step, guided by stopwatch, has failed.
Actually, I'm using an IF to show the error text. I was trying put some variable inside the macro that receive an identifier to the step. The code is below.
Thanks!
Code: Select all
Option Explicit
Dim macro
macro = "VERSION BUILD=10002738" + vbNewLine
macro = macro + "TAB T=1 " + vbNewLine
macro = macro + "TAB CLOSEALLOTHERS " + vbNewLine
macro = macro + "SET !FILESTOPWATCH C:\opmon\scripts\SEI_V3\output.csv" + vbNewLine
macro = macro + "STOPWATCH ID=T5_Total" + vbNewLine
macro = macro + "STOPWATCH ID=T1_PaginaInicial" + vbNewLine
macro = macro + "URL GOTO=URL" + vbNewLine
macro = macro + "STOPWATCH ID=T1_PaginaInicial" + vbNewLine
macro = macro + "STOPWATCH ID=T2_LogIn" + vbNewLine
macro = macro + "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:frmLogin ATTR=NAME:txtUsuario CONTENT=USER" + vbNewLine
macro = macro + "SET !ENCRYPTION NO" + vbNewLine
macro = macro + "TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:frmLogin ATTR=NAME:pwdSenha CONTENT=PASS" + vbNewLine
macro = macro + "TAG POS=1 TYPE=BUTTON:SUBMIT FORM=NAME:frmLogin ATTR=NAME:sbmLogin" + vbNewLine
macro = macro + "STOPWATCH ID=T2_LogIn" + vbNewLine
macro = macro + "STOPWATCH ID=T3_ControleProcessos" + vbNewLine
macro = macro + "TAG POS=1 TYPE=A ATTR=TXT:Controle<SP>de<SP>Processos" + vbNewLine
macro = macro + "STOPWATCH ID=T3_ControleProcessos" + vbNewLine
macro = macro + "STOPWATCH ID=T4_LogOff" + vbNewLine
macro = macro + "TAG POS=1 TYPE=IMG ATTR=SRC:https://URL/imagens/sair.gif" + vbNewLine
macro = macro + "STOPWATCH ID=T4_LogOff" + vbNewLine
macro = macro + "STOPWATCH ID=T5_Total"
Dim iim1, iret, iplay
Dim s
set iim1= CreateObject ("imacros")
iret = iim1.iimOpen ("-kioskmode",true)
iret = iim1.iimDisplay("Get Response Times")
iplay = iim1.iimPlayCode(macro)
Dim errortext
errortext = iim1. iimGetErrorText()
[b]If iplay < 0 Then
WScript.Echo "CRITICAL: The following error occurred on "+ [i]STEP [/i]+": " + errortext + vbNewLine
iret = iim1.iimClose
WScript.Quit(2)
End If[/b]
Dim idName
Dim T1_PaginaInicial,T2_LogIn,T3_ControleProcessos,T4_LogOff,T5_Total
iret = iim1.iimGetStopwatch(3,idName,T1_PaginaInicial)
iret = iim1.iimGetStopwatch(4,idName,T2_LogIn)
iret = iim1.iimGetStopwatch(5,idName,T3_ControleProcessos)
iret = iim1.iimGetStopwatch(6,idName,T4_LogOff)
iret = iim1.iimGetStopwatch(2,idName,T5_Total)
iret = iim1.iimClose
dim hoje
hoje = Now()
WScript.Echo "Passos executados em " & T5_Total & " segundos Executado em: " & hoje & " | T1_PaginaInicial=" & T1_PaginaInicial & "s;;;0; T2_LogIn=" & T2_LogIn & "s;;;0; T3_ControleProcessos=" & T3_ControleProcessos & "s;;;0; T4_LogOff=" & T4_LogOff & "s;;;0; T5_Total=" & T5_Total & "s;;;0;"
WScript.Quit(0)