vidaLL Posted July 17, 2013 Share Posted July 17, 2013 Hello all. You are master in autoit maybe can tell me easily... Whats wrong with my Loop ? expandcollapse popupHotKeySet("{ESC}", "Terminate") #include <Excel.au3> #include <IE.au3> Global $sExcelFile = "C:\Users\e8760255\Desktop\Pasta1.xls" ; <== Add the name of the Excel file here and your User Global $oExcel = _ExcelBookOpen($sExcelFile) Global $aExcelData = _ExcelReadSheetToArray($oExcel);$oExcel $oIE = _IECreate() _IENavigate($oIE, "https://webhomolog.fazenda.sp.gov.br/simp"); https://webhomolog.fazenda.sp.gov.br/simp ;=======================>FROM HERE While 1 $o_form = _IEFormGetObjByName($oIE, "form1") $o_txtCpf = _IEFormElementGetObjByName($o_form, "txtCpf") $o_txtNumDoc = _IEFormElementGetObjByName($o_form, "txtNumDoc") $O_btnConsultar = _IEFormElementGetObjByName($o_form, "btnConsultar") For $iRow = 1 To $aExcelData ; Process all read Excel rows _IEFormElementSetValue($o_txtCpf, $aExcelData[$iRow][1]) _IEFormElementSetValue($o_txtNumDoc, $aExcelData[$iRow][2]) Next $O_btnConsultar.click _IELoadWait($oIE) $o_form = _IEFormGetObjByName($oIE, "_ctl0") $o_btnContinuar = _IEFormElementGetObjByName($o_form, "btnContinuar") If IsObj($o_btnContinuar) Then $o_btnContinuar.click _IELoadWait($oIE) EndIf If not isObj($o_btnContinuar) Then $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnGare = _IEFormElementGetObjByName($o_form, "btnGare") $o_btnGare.click _IELoadWait($oIE) EndIf $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnGare = _IEFormElementGetObjByName($o_form, "btnGare") $o_btnGare.click _IELoadWait($oIE) ; Doc informations $o_form = _IEFormGetObjByName($oIE, "Form1") $o_txtObs = _IEFormElementGetObjByName($o_form, "txtObs") $o_txtDataPagto = _IEFormElementGetObjByName($o_form, "txtDataPagto") $o_txtReceita = _IEFormElementGetObjByName($o_form, "txtReceita") For $iRow = 1 To $aExcelData ; Process all read Excel rows _IEFormElementSetValue($o_txtObs, $aExcelData[$iRow][3]) _IEFormElementSetValue($o_txtDataPagto, $aExcelData[$iRow][4]) _IEFormElementSetValue($o_txtReceita, $aExcelData[$iRow][5]) Next $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnCalculoProd = _IEFormElementGetObjByName($o_form, "btnCalculoProd") $o_btnCalculoProd.click _IELoadWait($oIE) $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnGera = _IEFormElementGetObjByName($o_form, "btnGera") $o_btnGera.click _IELoadWait($oIE) Sleep (6000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (3000) Send("{ALTDOWN}") Send("s") Send("{ALTUP}") Sleep (1500) Send("!{F4}") Sleep (1500) $o_form = _IEFormGetObjByName($oIE, "_ctl0");Form1 $o_btnSair = _IEFormElementGetObjByName ($o_form, "btnSair") $o_btnSair.click _ExcelRowDelete($oExcel,1) ;=======================>TO HERE WEnd Func Terminate() Exit 0 EndFunc Appreciate your help. Link to comment Share on other sites More sharing options...
water Posted July 17, 2013 Share Posted July 17, 2013 What do you mean by "wrong"? Do you get a syntax error when running the script? Doesn't the script do what you expect it to do? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted July 17, 2013 Share Posted July 17, 2013 Indeed. You'll get an answer which is proportional to your input effort. There are several loops in there for starters. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
vidaLL Posted July 17, 2013 Author Share Posted July 17, 2013 What do you mean by "wrong"? Do you get a syntax error when running the script? Doesn't the script do what you expect it to do? The script is doing what I want, however what happens ... I have an excel file with e.g 200 lines that serves as a database to put the information in IE ...However I do not know how to do to the script go to the second line excel at the end of the script I put him to delete the first line, so I can rotate in all remaining lines. It was here enters the Loop, can not I do. Link to comment Share on other sites More sharing options...
water Posted July 17, 2013 Share Posted July 17, 2013 The content of the Excel sheet is already in the array. Process the array in the loop like this: expandcollapse popupHotKeySet("{ESC}", "Terminate") #include <Excel.au3> #include <IE.au3> Global $sExcelFile = "C:\Users\e8760255\Desktop\Pasta1.xls" ; <== Add the name of the Excel file here and your User Global $oExcel = _ExcelBookOpen($sExcelFile) Global $aExcelData = _ExcelReadSheetToArray($oExcel);$oExcel $oIE = _IECreate() _IENavigate($oIE, "https://webhomolog.fazenda.sp.gov.br/simp"); https://webhomolog.fazenda.sp.gov.br/simp ;=======================>FROM HERE For $iRow = 1 To $aExcelData[0][0] $o_form = _IEFormGetObjByName($oIE, "form1") $o_txtCpf = _IEFormElementGetObjByName($o_form, "txtCpf") $o_txtNumDoc = _IEFormElementGetObjByName($o_form, "txtNumDoc") $O_btnConsultar = _IEFormElementGetObjByName($o_form, "btnConsultar") _IEFormElementSetValue($o_txtCpf, $aExcelData[$iRow][1]) _IEFormElementSetValue($o_txtNumDoc, $aExcelData[$iRow][2]) $O_btnConsultar.click _IELoadWait($oIE) $o_form = _IEFormGetObjByName($oIE, "_ctl0") $o_btnContinuar = _IEFormElementGetObjByName($o_form, "btnContinuar") If IsObj($o_btnContinuar) Then $o_btnContinuar.click _IELoadWait($oIE) EndIf If Not IsObj($o_btnContinuar) Then $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnGare = _IEFormElementGetObjByName($o_form, "btnGare") $o_btnGare.click _IELoadWait($oIE) EndIf $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnGare = _IEFormElementGetObjByName($o_form, "btnGare") $o_btnGare.click _IELoadWait($oIE) ; Doc informations $o_form = _IEFormGetObjByName($oIE, "Form1") $o_txtObs = _IEFormElementGetObjByName($o_form, "txtObs") $o_txtDataPagto = _IEFormElementGetObjByName($o_form, "txtDataPagto") $o_txtReceita = _IEFormElementGetObjByName($o_form, "txtReceita") _IEFormElementSetValue($o_txtObs, $aExcelData[$iRow][3]) _IEFormElementSetValue($o_txtDataPagto, $aExcelData[$iRow][4]) _IEFormElementSetValue($o_txtReceita, $aExcelData[$iRow][5]) $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnCalculoProd = _IEFormElementGetObjByName($o_form, "btnCalculoProd") $o_btnCalculoProd.click _IELoadWait($oIE) $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnGera = _IEFormElementGetObjByName($o_form, "btnGera") $o_btnGera.click _IELoadWait($oIE) Sleep(6000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep(3000) Send("{ALTDOWN}") Send("s") Send("{ALTUP}") Sleep(1500) Send("!{F4}") Sleep(1500) $o_form = _IEFormGetObjByName($oIE, "_ctl0");Form1 $o_btnSair = _IEFormElementGetObjByName($o_form, "btnSair") $o_btnSair.click Next Func Terminate() Exit 0 EndFunc ;==>Terminate My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
vidaLL Posted July 17, 2013 Author Share Posted July 17, 2013 The content of the Excel sheet is already in the array. Process the array in the loop like this: expandcollapse popupHotKeySet("{ESC}", "Terminate") #include <Excel.au3> #include <IE.au3> Global $sExcelFile = "C:\Users\e8760255\Desktop\Pasta1.xls" ; <== Add the name of the Excel file here and your User Global $oExcel = _ExcelBookOpen($sExcelFile) Global $aExcelData = _ExcelReadSheetToArray($oExcel);$oExcel $oIE = _IECreate() _IENavigate($oIE, "https://webhomolog.fazenda.sp.gov.br/simp"); https://webhomolog.fazenda.sp.gov.br/simp ;=======================>FROM HERE For $iRow = 1 To $aExcelData[0][0] $o_form = _IEFormGetObjByName($oIE, "form1") $o_txtCpf = _IEFormElementGetObjByName($o_form, "txtCpf") $o_txtNumDoc = _IEFormElementGetObjByName($o_form, "txtNumDoc") $O_btnConsultar = _IEFormElementGetObjByName($o_form, "btnConsultar") _IEFormElementSetValue($o_txtCpf, $aExcelData[$iRow][1]) _IEFormElementSetValue($o_txtNumDoc, $aExcelData[$iRow][2]) $O_btnConsultar.click _IELoadWait($oIE) $o_form = _IEFormGetObjByName($oIE, "_ctl0") $o_btnContinuar = _IEFormElementGetObjByName($o_form, "btnContinuar") If IsObj($o_btnContinuar) Then $o_btnContinuar.click _IELoadWait($oIE) EndIf If Not IsObj($o_btnContinuar) Then $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnGare = _IEFormElementGetObjByName($o_form, "btnGare") $o_btnGare.click _IELoadWait($oIE) EndIf $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnGare = _IEFormElementGetObjByName($o_form, "btnGare") $o_btnGare.click _IELoadWait($oIE) ; Doc informations $o_form = _IEFormGetObjByName($oIE, "Form1") $o_txtObs = _IEFormElementGetObjByName($o_form, "txtObs") $o_txtDataPagto = _IEFormElementGetObjByName($o_form, "txtDataPagto") $o_txtReceita = _IEFormElementGetObjByName($o_form, "txtReceita") _IEFormElementSetValue($o_txtObs, $aExcelData[$iRow][3]) _IEFormElementSetValue($o_txtDataPagto, $aExcelData[$iRow][4]) _IEFormElementSetValue($o_txtReceita, $aExcelData[$iRow][5]) $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnCalculoProd = _IEFormElementGetObjByName($o_form, "btnCalculoProd") $o_btnCalculoProd.click _IELoadWait($oIE) $o_form = _IEFormGetObjByName($oIE, "Form1") $o_btnGera = _IEFormElementGetObjByName($o_form, "btnGera") $o_btnGera.click _IELoadWait($oIE) Sleep(6000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep(3000) Send("{ALTDOWN}") Send("s") Send("{ALTUP}") Sleep(1500) Send("!{F4}") Sleep(1500) $o_form = _IEFormGetObjByName($oIE, "_ctl0");Form1 $o_btnSair = _IEFormElementGetObjByName($o_form, "btnSair") $o_btnSair.click Next Func Terminate() Exit 0 EndFunc ;==>Terminate I tried it too... no sucess... If it is not asking too much but already asking, just try running the files I posted ...Pasta1.xlsWATER.au3 Link to comment Share on other sites More sharing options...
water Posted July 17, 2013 Share Posted July 17, 2013 Sorry, but I don't have the time to test it for you. Just a few seconds to post a few questions. If you run my version of the script do you get any error messages written to the Scite console? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
vidaLL Posted July 17, 2013 Author Share Posted July 17, 2013 No... Its runs normally but its not reading all lines of .xls it runs just once then stop. Weird Link to comment Share on other sites More sharing options...
water Posted July 17, 2013 Share Posted July 17, 2013 The loop runs 2 times for me. But I get a lot of errors because I don't do the clicks. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
vidaLL Posted July 17, 2013 Author Share Posted July 17, 2013 Sorry.. just correcting my previous message : is not transcribing the read information from next line. Link to comment Share on other sites More sharing options...
Solution water Posted July 17, 2013 Solution Share Posted July 17, 2013 Can you add a _IELoadWait at the end of the loop and try again? $o_form = _IEFormGetObjByName($oIE, "_ctl0");Form1 $o_btnSair = _IEFormElementGetObjByName($o_form, "btnSair") $o_btnSair.click _IELoadWait($oIE) ; <== Add this vidaLL 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
vidaLL Posted July 17, 2013 Author Share Posted July 17, 2013 Im your Fan man... Thanks very much Works like a charm . Link to comment Share on other sites More sharing options...
water Posted July 17, 2013 Share Posted July 17, 2013 Glad we could solve this problem My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
vidaLL Posted July 17, 2013 Author Share Posted July 17, 2013 water, a simples question : is there a way to use a Object from a webpage to "save target as" ? Link to comment Share on other sites More sharing options...
water Posted July 17, 2013 Share Posted July 17, 2013 Don't know. But I remember there was a thread regarding this subject just a few days ago. So if you search the forum for "save target as" ... My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now