I made a script to automate register of new users in my system, a hod java emulator:
and here is the code:
Code: Select all
#SingleInstance force
SetKeyDelay, 4
#IfWinActive Terminal 3270 - A - AWVL6661
!q::
X1 := ComObjActive("Excel.Application")
Loop, 3 {
Cpf%A_Index% := X1.Range("A" A_Index).Text
Banco%A_Index% := X1.Range("B" A_Index).Text
Agencia%A_Index% := X1.Range("C" A_Index).Text
Conta%A_Index% := X1.Range("D" A_Index).Text
}
n:= 1
Loop, 3 {
Send, % Cpf%n%
Sleep, 500
Send, {enter}
Sleep, 500
Send, {tab}
Send, bsb{tab}{tab}
Send, 9701
Send, 70000000df{enter}
Sleep, 250
Send, npto{enter}
Send, s{enter}
Sleep, 250
Send, % Banco%n%
Sleep, 500
Send, % Agencia%n%
Sleep, 500
Send, % Conta%n%
Sleep, 500
Send, {tab}1
Send, {enter}
Sleep, 500
Send, pto{enter}
Sleep, 250
Send, s{enter}
n := n + 1
}
return
the problem is: if the creditor already exists in database (its possible, because the company have many branches registering users) the screen changes for new data. therefore, the script mess and dont work, because wrong data is inserted in wrong places, some protected. That is the screen showed when the creditor exist: so, I need an idea for handle that. for recognize when the screen changes (is different) for the script return to other point or next creditor in excel