Jump to content

vinyking

Active Members
  • Posts

    24
  • Joined

  • Last visited

Community Answers

  1. vinyking's post in Help Needed on looping through excel column was marked as the answer   
    Thanks to Wruck, Markyrocks, and every body,
    I followed your lead read through the examples, tried out my hands on a couple of examples and finally here is the code that works for me.
    #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <IE.au3> #include <Excel.au3> #include <Array.au3> ;----------------------------------------------------------------------------- ;trying to open web page login form ;----------------------------------------------------------------------------- $oIE = _IECreate("http://www.mywebpage") $oForm = _IEFormGetObjByName($oIE, "form name") Local $oQuery = _IEFormElementGetObjByName($oForm, "login") _IEFormElementSetValue($oQuery, "log in name") Local $oQuery = _IEFormElementGetObjByName($oForm, "password") _IEFormElementSetValue($oQuery, "my password") _IEFormSubmit($oForm) Sleep(4000) ;----------------------------------------------------------------------------- ;web page login complteted ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ;Open Excel file and capture/read Array ;----------------------------------------------------------------------------- Local $sFilePath1 = "file path\Myexcell file.xlsx" ;This file should already exist Local $oExcel = _ExcelBookOpen($sFilePath1) If @error = 1 Then MsgBox(0, "Error!", "Unable to Create the Excel Object") Exit ElseIf @error = 2 Then MsgBox(0, "Error!", "File does not exist - Shame on you!") Exit EndIf Dim $cell[1001] Local $aArray1 = _ExcelReadArray($oExcel, 1, 2, 4, 1) ;Direction is Vertical _ArrayDisplay($aArray1, "Vertical") _ExcelBookSaveAs($oExcel, "file path\Myexcell file.xlsx") ; file saved _ExcelBookClose($oExcel) ; And finally we close out ;----------------------------------------------------------------------------- ;Excel file opened Array reading completed and Excel file closed ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ;Lopping through Array and executing Web form ;----------------------------------------------------------------------------- For $i = 0 To UBound($aArray1) - 1 _IENavigate($oIE, "http://www.mywebpage") $oForm = _IEFormGetObjByName($oIE, "form name") Local $oQuery = _IEFormElementGetObjByName($oForm, "form id") _IEFormElementSetValue($oQuery, $aArray1[$i]) Local $oSubmit = _IEGetObjByName($oIE, "button") _IEAction($oSubmit, "click") _IELoadWait($oIE) _IEAction($oIE, "print") Sleep(9000) Next ;----------------------------------------------------------------------------- ;end of Loop through Array and executing Web form ;----------------------------------------------------------------------------- _IEAction($oIE, "quit") Now I am moving on to other challenges as regard this project.
    Cheers
×
×
  • Create New...