SeanRichardson Posted June 29, 2011 Share Posted June 29, 2011 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! expandcollapse popup#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 Link to comment Share on other sites More sharing options...
sleepydvdr Posted June 29, 2011 Share Posted June 29, 2011 Would this not work? #include <array.au3> #include <string.au3> #include <file.au3> $docLines = _FileCountLines("test.csv") For $i = 1 to $docLines $line = FileReadLine("test.csv", $i) $ary = StringSplit($line, ",") WinActivate("Add Physician","Fusion Voice Setting") Send("" & $ary[2] & "") Send("{TAB}") Send("" & $ary[1] & "") Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") Send("" & $ary[6] & "") Send("{TAB}") Send("{ALTDOWN}m{ALTUP}") Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") Send("R") Send("{ALTDOWN}g{ALTUP}") Next #include <ByteMe.au3> 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