Jump to content

Donnovan

Active Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by Donnovan

  1. Hi! I am trying to automate a Portuguese software using the Send function, and to access one of the menu options i need to Send "´" and then "e"... that is, "é". How can i do that using the Send function? Thankyou!
  2. Same as ken82m, Anyone know how to get ride of the Excel 2007 tool bar?
  3. This, in VBA, make the Excel to show only the grid cells: Application.DisplayFullScreen = True I added the line "$oExcelDoc.Application.DisplayFullScreen = True" and got a error from Autoit. Not sure why.
  4. seangriffin, Considering all the automation you did with SAP, have you missed a "_SAPWaitLoad()" function, like the "_IEWaitLoad()" function we have on the IE UDF? For example, on this script, taken from a preview post, i see the function sleep(1000) was used to make the script wait SAP to load, but this is a bad way to do it. #include <SAP.au3> _SAPSessAttach("SAP Easy Access") _SAPObjValueSet("tbar[0]/okcd", "XD02") _SAPVKeysSend("Enter") sleep(1000) _SAPSessAttach("Cliente modificar: 1ª tela") _SAPObjValueSet("usr/ctxtRF02D-KUNNR", "123456") How have you dealed with script and SAP syncronization? Since i will automate SAP to do a man work, repeating a process thousand of times, i really need to sync script and SAP to prevent the script to flood SAP with commands. If the script reachs "round" 5 and SAP is still on "round" 2, for sure some error will occurs.
  5. This UDF is what i mencioned here "I'm using COM access to SAP, using a group of functions found on this forum". Thanks for the link. I also use IE UDF that comes with Autoit, it have a function called "_IELoadWait" that prevent you from sending commands while IE is loading. I see no "LoadingWait" function on the SAP UDF, so i believe we will need to deal with that on the code we wrote or, may be, its not necessary for SAP UDF. There is no need for a "_SAPLoadWait" function on SAP UDF?
  6. Hi, I have experience automating a IBM terminal, and the father of all problems on it was the random time the terminal takes to respond to some comands. Since i dont know how much time IBM terminal will take to do the task, i dont know how much time the script needs to wait until send the next task. This was solved looking at the staturbar and getting from it the terminal state, if it is "thinking/processing" or if it is ready for the next commands. Now with SAP, i believe to have the same problem because there is no info on status bar to tell me if its processing something or ready to new imputs. Anyone have presenced any timing problems in SAP automation? Or it seens to respond in a realtime behavior causing no harm to the code flow? I'm using COM access to SAP, using a group of functions found on this forum. Thanks.
  7. Thanks a lot MrMitchell. Sadly, i can't do it on the real script. This small script was done to simulate the problem. Talking on the real script, the code repeat on MyErrFunc() worked! Here is it: Func MyErrFunc() ; Msgbox(0,"Test","Error !" & @CRLF & @CRLF & _ ; "err.description is: " & @TAB & $oMyError.description & @CRLF & _ ; "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ ; "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _ ; "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ ; "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ ; "err.source is: " & @TAB & $oMyError.source & @CRLF & _ ; "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ ; "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ; ) If $oMyError.scriptline = 20 Then $oInput.Value = $oExcel.Activecell.Value ElseIf $oMyError.scriptline = 33 Then $oExcel.Activecell.Offset(1,0).Select ElseIf $oMyError.scriptline = 35 Then $oCell = $oExcel.Activecell.Value ElseIf $oMyError.scriptline = 54 Then $oExcel.Activecell.Offset( 0 , $x ).Select ElseIf $oMyError.scriptline = 58 Then $oExcel.Activecell.Offset( 0 , 1 ).Select ElseIf $oMyError.scriptline = 62 Then $oExcel.Activecell.Offset( 0 , 105 - $y ).Select ElseIf $oMyError.scriptline = 66 Then $oExcel.Activecell.Offset(0,1).Select ElseIf $oMyError.scriptline = 67 Then $oExcel.Activecell.Value = $oElement.Value ElseIf $oMyError.scriptline = 69 Then $oExcel.Activecell.Offset(1,-$y).Select EndIf Local $err = $oMyError.number If $err = 0 Then $err = -1 $g_eventerror = $err ; to check for after this function returns Endfunc 20, 33, 35, 54, etc... are the lines of the real script that can give error. So if they fail, i repeat the code. The chance to it fail again is minimal, i believe.
  8. The only remanin idea by me is this one: With Juvigy erro handler code i see that the script continues to run after the error. So, based on the line that gave the error ($oMyError.scriptline)i will to execute the code of that line, again, inside MyErrFunc() so then the script can continues like if there was no error. You guys agree?
  9. I already have tryed a method i believe is better, but the same error happens, althoug it happens on Excel.au3, and not in my Script. This one: Here the script: #include <Excel.au3> $oExcel = ObjGet("","Excel.Application") For $y = 1 to 256 For $x = 1 to 65000 _ExcelWriteCell($oExcel,"Cell Text!",$x,$y) Next Next I ran the script and leaved the computer alone. On second try i added a line to hide Excel. Already got the errors, but now it happens on Excel.au3 include script, on the call $oExcel.Activesheet.Cells($sRangeOrRow, $iColumn).Value = $sValue. The place of the error, on the call, was different for the two cases: $oExcel.Activesheet^ ERROR and $oExcel.Activesheet.Cells($sRangeOrRow, $iColumn).Value = $sValue^ ERROR
  10. The column and row where the error happens change each time. The script run time give you an idea: >Exit code: 1 Time: 250.541 >Exit code: 1 Time: 565.930 >Exit code: 1 Time: 622.915 After starting the script, i minimize AutoIt and Excel an continue working in other programs, so yes, i hit arrow keys, but not in the Excel windows. I believe i also tested this example script leaving it work alone, but not sure. Will do it when i get home.
  11. Here the error: It was on this line: If $oExcel.Activecell.Value = $sevEnd Then $end = 1 Edit: This time the error was in line: $oExcel.Activecell.Offset(0,1).Select The error info is the same above.
  12. I believe this is a COM related question, but as i'm not sure, i posted it here, not in "ActiveX/COM Help and Support (AutoItX)". I made a very simple script: $oExcel = ObjGet("","Excel.Application") For $y = 1 to 256 For $x = 1 to 65000 $oExcel.Activecell.Value = $x $oExcel.Activecell.Offset(1,0).Select Next $oExcel.Activecell.Offset(-65000,1).Select Next This is a image of it running: There is nothing wrong with this script, but son or not so soon, it gives a error on $oExcel.Activecell.Value or $oExcel.Activecell.Offset, with the reason "The requested action with this object has failed". Here examples of the errors: Why those erros happens? May be the command $oExcel.Activecell.Value and $oExcel.Activecell.Offset just "overheats" and give a error? I tryed to check $oExcel with IsObj($oExcel), before the commands, to make sure the Excel object is ok, and it's always ok. Why the request fails?
  13. My script open a IE window, hide it and then start to work in it. Ocasionaly this IE hide window generate a small window like "Code not found" and all those information windows. The problem i'm having is that those pop up small windows are visible. There is a way to make then not visible like the main window that generated then?
  14. Thanks a lot! _IE... and _Excel... functions made a 1000% upgrade on my code!!! Faster, No Syncronism errors, and i can work while the script runs!
  15. Thanks for the answers! Things are changing. Firstly i was unable to use the computer when AutoIt was running, since any key pressed was able to make the script stop or write in the wrong windows or delete the wrong cell, etc... Dim $contador1 = 0 Dim $sevNum = "" Dim $check = "" Dim $answer = 0 Dim $linha[13][3] Dim $opc[3] Dim $x = 0 Dim $y = 0 Dim $z = 0 Dim $rep = 0 Dim $end = "" Dim $delay = 0 $delay = 5 ; demora entre os toques de tecla (em milisegundos) $rep = 20000 ; número de SEV's à pegar $end = "1328630" ; ultima SEV da lista For $contador1 = 1 to $rep clipput("") Opt("SendKeyDelay", $delay) Opt("SendKeyDownDelay", 5) WinActivate("[CLASS:XLMAIN]") send("{F2}{SHIFTDOWN}{HOME}{SHIFTUP}^c{ESC}") $sevNum=Clipget() While $sevNum="" sleep(5) $sevNum = clipget() WEnd WinActivate("[CLASS:IEFrame]") clipput("") send("q") sleep(80) send("^c") While clipget()="" sleep(5) WEnd If StringInStr(clipget(),"TIPO DE CAMPO INCORRETO!")=0 Then Exit Endif send("{ENTER}") send($sevNum&"{ENTER}") $check="" $x=1 while $check<>"Aguardando" And $x<=70 Sleep(5) $check=stringleft(StatusbarGetText("[CLASS:IEFrame]"),10) $x=$x+1 WEnd while $check<>"Concluído" Sleep(5) $check=StatusbarGetText("[CLASS:IEFrame]") WEnd Sleep(30) send("^c") Sleep(30) If StringInStr(clipget(),"REGISTRO NÃO ENCONTRADO!")<>0 Then Send("{ENTER}") Endif clipput("Valor estimado (Projeto Solução)") send("^f^v") sleep(20) If ControlGetText("[CLASS:IEFrame]", "", "Static3") = "Nenhuma correspondência encontrada" Then send("{ALTDOWN}{CTRLDOWN}{TAB 3}{CTRLUP}{ALTUP}{TAB}") WinActivate("[CLASS:XLMAIN]") send("{DOWN}") Else For $x = 1 to 3 clipput("Opção de Nro.: "&$x) send("^f{SHIFTDOWN}{HOME}{SHIFTUP}{DEL}^v") sleep(20) $opc[$x-1]=ControlGetText("[CLASS:IEFrame]", "", "Static3") Next send("{ALTDOWN}{CTRLDOWN}{TAB 3}{CTRLUP}{ALTUP}{TAB 9}") Sleep(40) send("^c") sleep(20) $linha[0][0]=clipget() send("{TAB}^c") Sleep(20) $linha[1][0]=clipget() send("{TAB}^c") Sleep(20) $linha[2][0]=clipget() send("{TAB}^c") Sleep(20) $linha[3][0]=clipget() send("{TAB}^c") Sleep(20) $linha[4][0]=clipget() send("{TAB}^c") Sleep(20) $linha[5][0]=clipget() send("{TAB}^c") Sleep(20) $linha[6][0]=clipget() send("{TAB}^c") Sleep(20) $linha[7][0]=clipget() send("{TAB 39}^c") Sleep(20) if $linha[7][0]=clipget() Then send("{TAB}^c") sleep(20) EndIf $linha[8][0]=clipget() send("{TAB}^c") Sleep(20) $linha[9][0]=clipget() send("{TAB}^c") Sleep(20) $linha[10][0]=clipget() send("{TAB 5}{SHIFTDOWN}{PGDN}{SHIFTUP}^c") Sleep(20) $linha[11][0]=clipget() For $x = 1 to 2 If $opc[$x] <> "Nenhuma correspondência encontrada" Then send("{TAB}^c") sleep(20) if $linha[11][$x-1]=clipget() Then send("{TAB}^c") sleep(20) EndIf $linha[8][$x]=clipget() send("{TAB}^c") Sleep(20) $linha[9][$x]=clipget() send("{TAB}^c") Sleep(20) $linha[10][$x]=clipget() send("{TAB 5}{SHIFTDOWN}{PGDN}{SHIFTUP}^c") Sleep(20) $linha[11][$x]=clipget() EndIf Next clipput("") send("{TAB}{SHIFTDOWN}{PGDN}{SHIFTUP}^c") Sleep(20) $linha[12][2]=clipget() send("{ALTDOWN}{LEFT}{ALTUP}") sleep(50) send("^c") sleep(20) If StringInStr(clipget(),"REGISTRO NÃO ENCONTRADO!")<>0 Then Send("{ENTER}") Endif send("{SHIFTDOWN}{HOME}{SHIFTUP}{DEL}") sleep(20) WinActivate("[CLASS:XLMAIN]") send("{RIGHT}") Sleep(10) For $x = 0 to 7 clipput($linha[$x][0]) Sleep(10) send("{DEL}{F2}^v{ENTER}{UP}{RIGHT}") next $z=8 For $x = 0 to 2 If $opc[$x]<>"Nenhuma correspondência encontrada" Then For $y = 8 to 11 clipput($linha[$y][$x]) if $y=11 Then send("{DEL}{F2}^v{ENTER}{UP}{ALT}cel{ENTER}{RIGHT}") Else send("{DEL}{F2}^v{ENTER}{UP}{RIGHT}") EndIf $z=$z+1 Next EndIf next clipput($linha[12][2]) If $z <20 Then send("{RIGHT " & 21-$z-1 & "}{DEL}{F2}^v{ENTER}{UP}{ALT}cel{ENTER}") Else send("{DEL}{F2}^v{ENTER}{UP}{ALT}cel{ENTER}") EndIf Send("{HOME}") Sleep(35) Send("{DOWN}") EndIf Sleep(30) WinActivate("[CLASS:SciTEWindow]") if $sevNum=$end Then Exit EndIf Next But now, using _IE and and Object Excel Management, i believe i can run autoit with invisible windows and continue to do paralel work. So the problem will be solved since people can use the computer normally with no interference with AutoIt: Here the progress: #include <IE.au3> $rep = 100 $oExcel = ObjGet("","Excel.Application") $oIE = _IEAttach ("", "instance", 1) ;$oIE = _IECreate("http://ntspo912/ssa/Scripts/Mev_ConsSolFinal.asp") _IENavigate ($oIE,"http://ntspo912/ssa/Scripts/Mev_ConsSolFinal.asp") While 1 $oForm = _IEFormGetCollection ($oIE,0) $oInput = _IEFormElementGetCollection ($oForm,2) $oSubmit = _IEFormElementGetCollection ($oForm,3) $oInput.Value = $oExcel.Activecell.Value _IEAction ($oSubmit, "click") _IELoadWait ($oIE) If WinExists("[CLASS:#32770]") Then WinClose("[CLASS:#32770]", "") ElseIf _IEPropertyGet ($oIE, "locationurl") <> "http://ntspo912/ssa/Scripts/Mev_ConsSolFinal.asp" Then ExitLoop EndIf $oExcel.Activecell.Offset(1,0).Select WEnd For $x = 1 to $rep $oForm = _IEFormGetCollection ($oIE,0) MsgBox(0,"",@extended) $oElements = _IEFormElementGetCollection ($oForm) $y = 0 For $oElement in $oElements If $oElement.type <> "hidden" Then $oExcel.Activecell.Offset(0,1).Select $oExcel.Activecell.Value = $oElement.value $y = $y + 1 EndIf Next Exit $oExcel.Activecell.Offset(1,-$y).Select While 1 $oForm = _IEFormGetCollection ($oIE,1) $oInput = _IEFormElementGetCollection ($oForm,2) $oSubmit = _IEFormElementGetCollection ($oForm,3) ; $oInput = _IEFormElementGetObjByName ($oForm, "inputsev") ; $oSubmit = _IEFormElementGetObjByName ($oForm, "submitsev") $oInput.Value = $oExcel.Activecell.Value _IEAction ($oSubmit, "click") _IELoadWait ($oIE) If WinExists("[CLASS:#32770]") Then WinClose("[CLASS:#32770]", "") ElseIf _IEPropertyGet ($oIE, "locationurl") <> "http://ntspo912/ssa/Scripts/Mev_ConsSolFinal.asp" Then ExitLoop EndIf $oExcel.Activecell.Offset(1,0).Select WEnd Next This second version do the same thing but is way more fast, and i can hide Esxel and IE windows. Thanks!
  16. Try to enable Compatibility View for websites in Internet Explorer. I found this tip on Not needed to use it myself, but maybe you can give a try.
  17. I leave my work and AutoIt continues running all night since i return on the next day and stop it by clicking on the Autoit icon in the system tray. My worry is if someone press any key of the keyboard or mouse button in my ausence, causing the script to fail. There is a way to block keyboard and/or mouse until someone (in most cases, me) click on the Autoit icon on the system tray and stop the script? Thanks a lot!
  18. If what you want is just to stop the code for 30 seconds, you can use: Sleep(30000) OBS: 30000 milliseconds = 30 seconds
  19. Hí! I want to show in a MsgBox a value i get form a cell in Excel. I start AutoIt with the Excel cursor in this cell. The code bellow do not work because the message box show a null valor: Dim $answer = 0 ClipPut("") WinActivate("[CLASS:XLMAIN]") send("^c") $answer = MsgBox(1,"",Clipget()) If i add a Sleep, it works, the MsgBox show the cell value: Dim $answer = 0 ClipPut("") WinActivate("[CLASS:XLMAIN]") send("^c") Sleep(30) $answer = MsgBox(1,"",Clipget()) The "^c" command take some time to conclude, and in parallel the Autoit code continues running, causing severe problems on my script. There is any way to copy values other than "Send("^c")" and then "Sleep(30)"? A way that stop the code until the value get copyed? Thankyou!
  20. I use a terminal in TXT format on my work, running in a window inside Windows Vista. AutoIt: I want to get a string from a specific part of the terminal window and put it in a AutoIt variable. It's possible to do that? OBS: The cursor can reach any part of the terminal window by using arrows, and it's also possible to select the required text and use Control + V to copy it. Thanks in advance! André.
×
×
  • Create New...