Code: Select all
Excel := ComObjCreate("Excel.Application")
Excel.Workbooks.Open("C:\Users\XXX\Desktop\XXXXXXXX.xlsx")
Excel.Visible := True
linhacontrole := 22
loop 1 {
tipo_obra := Excel.Range("B" linhacontrole).value
num_obra := Excel.Range("C" linhacontrole).Value
;Abrindo Janela e acessando movimento 2-1-2
WinActivate, Sistema de Acompanhamento e Gerenciamento de Obras de Distribu - \\Remote
Sleep, 2000
MouseClick, left, 196, 43 ;propriedade para clicar em Movimentos, pode variar de a cordo com a resolução do usuário.
Send, 2
Send, 2
Send, 1
Sleep, 2000
Send, %num_obra%
Sleep, 2000
;Clica em incluir
MouseClick, left, 29, 91
Sleep, 2000
if (linhacontrole <=21 ){
controle_mat := 3
quantidade :=""
loop 11{
material := Excel.Range("M" controle_mat).Value
Send, %material%{TAB}
if (tipo_obra = "URBANO"){
quantidade := Excel.Range("O" controle_mat).value
}
Else if (tipo_obra ="RURAL"){
quantidade :=Excel.Range("P" controle_mat).value
}
Send, %quantidade%{TAB}
Send, 0{TAB}
Send, {TAB}{TAB}{TAB}
controle_mat := controle_mat + 1
}
}
Else if (linhacontrole >=22) AND (linhacontrole <=31){
controle_mat := 24
quantidade := Excel.Range("O" controle_mat).Value
loop 3 {
material := Excel.Range("M" controle_mat).Value
Send, %material%{TAB}
Send, %quantidade%{TAB}
Sleep, 3000
Send, 0{TAB}
Send, {TAB}{TAB}{TAB}
controle_mat = controle_mat + 1
}
}
Send, {F11}
Sleep, 1000
linhacontrole := linhacontrole + 1
}