Jump to content



Photo

Read Excel file cell data loop to $input


  • Please log in to reply
8 replies to this topic

#1 ironsled

ironsled

    Seeker

  • Active Members
  • 17 posts

Posted 09 August 2012 - 09:02 PM

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)
Next

The 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. :idea:

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!

AutoIt         
#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}")

Attached Files


Edited by Melba23, 10 August 2012 - 04:56 PM.
Added code tags








#2 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 09 August 2012 - 10:45 PM

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.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#3 ironsled

ironsled

    Seeker

  • Active Members
  • 17 posts

Posted 10 August 2012 - 02:22 PM

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)

Next

Sorry 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. :idiot:

Many thanks for your help!! I really appreciate it!!

#4 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 10 August 2012 - 03:41 PM

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.)

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#5 ironsled

ironsled

    Seeker

  • Active Members
  • 17 posts

Posted 10 August 2012 - 04:46 PM

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 by ironsled, 10 August 2012 - 05:39 PM.


#6 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 10 August 2012 - 04:49 PM

You have to move your code into the function (where I left the comment)

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#7 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,387 posts

Posted 10 August 2012 - 04:57 PM

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
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#8 ironsled

ironsled

    Seeker

  • Active Members
  • 17 posts

Posted 10 August 2012 - 04:59 PM

LOL! I didnt see that first time around. You ROCK!! Thanks again!!! I owe you many beers!

#9 ironsled

ironsled

    Seeker

  • Active Members
  • 17 posts

Posted 10 August 2012 - 05:04 PM

@Melba, sorry. I will from now on. :bye:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users