I am sure this has been asked and answered 1000 times but I could not find what I am looking for in the forum.
I am trying to automate a repetitive task by using the data in a csv file.
Example data
0001,1,1,1999
0002,1,1,1998
0003,2,1,2000
ect (5000 rows long so you can see how time consuming this is to type manually!)
I pulled the csv into an array but I need to skip the first line (info about the array) and then use the "Send ( xxxxx )" command to step through each column and then move on to the next row.
Please help me with the bit that allows me to start with row 1 and address each column then repeat with row 2 ect...
thanks!
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <Array.au3>
Global $g_bPaused = False
HotKeySet("{PAUSE}", "HotKeyPressed")
HotKeySet("{ESC}", "HotKeyPressed")
Local $aArray = 0
_FileReadToArray("C:\mfgdates.csv", $aArray, Default, ",")
Local $iRows = UBound($aArray, $UBOUND_ROWS)
Local $iCols = UBound($aArray, $UBOUND_COLUMNS)
Local $iDimension = UBound($aArray, $UBOUND_DIMENSIONS) ; The dimension of the array e.g. 1/2/3 dimensional.
MsgBox($MB_SYSTEMMODAL, "", "The array is a " & $iDimension & " dimensional array with " & _
$iRows & " row(s) & " & $iCols & " column(s).")
IPTOOL()
Func IPTOOL()
If @error Then
MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error)
Else
For $i = 0 To $iRows - 1 ;this doesnt work (sad face)
Send($aArray[column1]) ;how do I declare column1, 2, 3, 4???
Sleep(500)
Send("{ENTER}")
Sleep(6000)
Send($aArray[column2])
Sleep(500)
Send("{ENTER}")
Sleep(5000)
Send($aArray[column3])
Sleep(500)
Send("{ENTER}")
Sleep(5000)
Send($aArray[column4])
Sleep(500)
Send("{ENTER}")
Sleep(5000)
MsgBox($MB_SYSTEMMODAL, "", $aArray[column1] & "," & " " & $aArray[column2] & "," & " " & $aArray[column3] & "," & " " & $aArray[column4])
Next
EndIf
EndFunc
Func HotKeyPressed()
Switch @HotKeyPressed
Case "{PAUSE}"
$g_bPaused = Not $g_bPaused
While $g_bPaused
Sleep(100)
ToolTip('Script is "Paused"', 0, 0)
WEnd
ToolTip("")
Case "{ESC}"
Exit
EndSwitch
EndFunc