ironsled Posted August 9, 2012 Share Posted August 9, 2012 (edited) Hello,I'm currently writing a script to interact with a flash website to pull reports from a custodian. So far, the script is working. I'm wondering if it is possible to get the Excel read to loop?I've tried this script I found on the forums.#include <Excel.au3>Local $oExcel = _ExcelBookOpen(@ScriptDir & 'account.xlsx', 0, 0)For $i = 1 To 5 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF)NextThe script runs, and it pulls the 5th row data and doesn't start at 1.Im providing a sample of my script for 10 records that can be pulled when in my web session.As you can see in my code, I have to copy the code over & over, change the row number to make this work.I have over 316 records to process. There has to be a better solution than what I doing. Is there a way to do this without having to recreate lines of code for each row of data within the excel file?Many thanks to all that respond!expandcollapse popup#include <Excel.au3> Local $oExcel = _ExcelBookOpen(@ScriptDir & 'account.xlsx', 0, 0) For $i = 1 To 1 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 1 To 1 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 1 To 1 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}") For $i = 2 To 2 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 2 To 2 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 2 To 2 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}") For $i = 3 To 3 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 3 To 3 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 3 To 3 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}") For $i = 4 To 4 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 4 To 4 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 4 To 4 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}") For $i = 5 To 5 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 5 To 5 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 5 To 5 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}") For $i = 6 To 6 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 6 To 6 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 6 To 6 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}") For $i = 7 To 7 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 7 To 7 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 7 To 7 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}") For $i = 8 To 8 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 8 To 8 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 8 To 8 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}") For $i = 9 To 9 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 9 To 9 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 9 To 9 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}") For $i = 10 To 10 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) ;ConsoleWrite($sCellValue & @CRLF) Next For $j = 10 To 10 ;Loop $sCellValue2 = _ExcelReadCell($oExcel, $j, 2) ;ConsoleWrite($sCellValue & @CRLF) Next For $k = 10 To 10 ;Loop $sCellValue3 = _ExcelReadCell($oExcel, $k, 3) ;ConsoleWrite($sCellValue & @CRLF) Next WinActivate ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") WinWaitActive ("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/Flex/Default.aspx[/url] - Windows Internet Explorer") Sleep (1000) MouseMove ( 1478, 180) MouseClick ("primary", 1478, 180, 1) Sleep (3000) MouseMove ( 96, 402 ) Sleep (3000) MouseClick("primary", 96, 402, 1) MouseClick("primary", 48, 416, 1) Send ( $sCellValue) Send ( "{TAB}") Send ( $sCellValue2) Send ( "{TAB}") Send ( $sCellValue3) Send ("{ENTER}") Sleep (5000) MouseMove ( 478, 402) MouseClick("primary", 478, 402, 1) Sleep (3000) Send("{CTRLDOWN}") Send("{SHIFTDOWN}") Send("s") Send("{CTRLUP}") Send("{SHIFTUP}") Sleep (1000) Send ( "w:ImagingArchivedReportsStatementsMSSB" & $sCellValue2 ) Send ("{ENTER}") winactivate("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") winwaitactive("[url="https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/"]https://mmportal.ms.com/Site/Secure/ManagerDashboard/Main/OnDemand/statements.aspx?url=http%3A/[/url] - Windows Internet Explorer") send ("!{F4}")MSSB_EXCEL.au3 Edited August 10, 2012 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
water Posted August 9, 2012 Share Posted August 9, 2012 Is there a way to do this without having to recreate lines of code for each row of data within the excel file?That's what functions are for. Create a function that does all the processing needed for every row and pass the row etc. as parameters. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki  Link to comment Share on other sites More sharing options...
ironsled Posted August 10, 2012 Author Share Posted August 10, 2012 Thanks for the reply. Unfortunately, I'm over my head on this one. I've read the help files and not really sure how to format Func to work as I need it. Can you provide an example?Would I still use this code with Func? For $i = 1 To 316 ;Loop $sCellValue = _ExcelReadCell($oExcel, $i, 1) $sCellValue2 = _ExcelReadCell($oExcel, $i, 2) $sCellValue3 = _ExcelReadCell($oExcel, $i, 3) NextSorry for being a complete noob to this. I really want to understand what it is Im trying to do, however, its not coming to me as fast as I would like it too. Many thanks for your help!! I really appreciate it!! Link to comment Share on other sites More sharing options...
water Posted August 10, 2012 Share Posted August 10, 2012 The function should contain the code you want to execute for every cell (or every row) in your excelsheet. Let's assume you want to process 3 cells in every row from 1 to 316. The script should look like: For $i = 1 to 316 $sCellValue1 = _ExcelReadCell($oExcel, $i, 1) $sCellValue2 = _ExcelReadCell($oExcel, $i, 2) $sCellValue3 = _ExcelReadCell($oExcel, $i, 3) ProcessCells($sCellValue1, $sCellValue2, $sCellValue3) Next Func ProcessCells($sValue1, $sValue2, $sValue3) ; enter the code that should be run for every cell EndFunc What's missing is some error handling (check if _ExcelReadCell was successful etc.) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki  Link to comment Share on other sites More sharing options...
ironsled Posted August 10, 2012 Author Share Posted August 10, 2012 (edited) When the script starts to pull the cell data, it doesnt start at number 1. It pulls from the ending number first. Example: 1 to 5 - it send the 5th row cell data. Edited August 10, 2012 by ironsled Link to comment Share on other sites More sharing options...
water Posted August 10, 2012 Share Posted August 10, 2012 You have to move your code into the function (where I left the comment) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki  Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 10, 2012 Moderators Share Posted August 10, 2012 ironsled,When you post code in future, please use Code tags - put [autoit] before and [/autoit] after your posted code. Then you get tidy scrolling boxes - as you can see in your first post now I have added them. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
ironsled Posted August 10, 2012 Author Share Posted August 10, 2012 LOL! I didnt see that first time around. You ROCK!! Thanks again!!! I owe you many beers! Link to comment Share on other sites More sharing options...
ironsled Posted August 10, 2012 Author Share Posted August 10, 2012 @Melba, sorry. I will from now on. 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