Jump to content

Read Excel file cell data loop to $input


Recommended Posts

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!

#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 by Melba23
Added code tags
Link to comment
Share on other sites

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 - 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 (NEW 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

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!!

Link to comment
Share on other sites

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 - 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 (NEW 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

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 - 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 (NEW 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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...