Hello,
I am almost done with writing the program below. My problem is when I go to get the next line in the file, the first line works great. I am writing it in autoit and I heard it is similar to Basic so hopefully someone could help. I am writing it in autoit for the reason that I need to use data from a file to populate a running program. If you can see where I am going wrong let me know it would be very helpful! The basics of the program is get a line that is delimited by "," and put the data into an array. Then put specific data into the program. Next, get a new line. I am doing some checking to see if the array is full or not. If so, it deletes the contents, if not (first line) in runs the for loop. Thanks!
#include <Array.au3>
Local $ary[1]
$file = FileOpen("test.csv",0)
MsgBox(0, "Bugging","Opened File")
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
$line = FileReadLine($file)
While 1
MsgBox(0, "Bugging","In While")
$tempy = _ArraySize( $ary)
If $tempy > 1 Then
MsgBox(0, "Bugging","In If line 18")
WinActivate("Add Physician","Fusion Voice Setting")
Send("" & $ary[2] & "")
Send("{TAB}")
Send("" & $ary[1] & "")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("" & $ary[6] & "")
Send("{TAB}")
Send("{ALTDOWN}m{ALTUP}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("R")
Send("{ALTDOWN}g{ALTUP}")
ReDim $ary[1]
$temp1 = _ArraySize( $ary)
MsgBox(0,"TESTING",$temp1)
ElseIf $tempy = 1 Then
$len = StringLen($line)
$start = 0
For $i = 1 to $len Step +$start
$start += 1
$end = StringInStr($line,',',0,1,$start)
If $end = 1 Then
$end = $len
EndIf
$tstr = StringMid($line, $start, $end - $start)
_ArrayAdd($ary,$tstr)
$end -= $start
$start += $end
$i = $start
If $i == $len Then
ExitLoop
EndIf
Next
$line = FileReadLine($file)
EndIf
If @error = -1 Then ExitLoop
Wend
_ArrayDisplay($ary)
FileClose($file)
Func _ArraySize( $aArray )
SetError( 0 )
$index = 0
Do
$pop = _ArrayPop( $aArray )
$index = $index + 1
Until @error = 1
Return $index - 1
EndFunc