• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AutoIt Script to Read a .csv file and execute the commands

kunchi

New Member
Joined
Apr 1, 2009
Messages
1
Reaction score
0
Location
UTAH
HELP with WHEN LOOP Please :)

I have a csv file with any number of rows in it.

I can read a row if I specify the row and then split the string to create a command line based on the data in that row and thus execute it.

However I don't want to do a for because each time I add a row I would need to modify the script.

example .csv file
data1,data2,data3,data4
data1,data3,data3,data4

code I have so far:
#include <GUIConstants.au3>
#include <string.au3>

$file = FileOpen("test.csv", 0)

If $file = -1 Then
MsgBox(0, "error", "File doesn't exist or can't be read")
Exit
EndIf

$string = (FileReadLine($file, 1))
$input = StringSplit($string, ",", 1)
$value1 = $input[1]
$value2 = $input[2]
$value3 = $input[3]
$value4 = $input[4]

$Commandline = "Test.exe " & "-dll "& $value1 & " -name " & $value2 & " -xml " & $value3 & " -in " & $value4

I am basically automating a Test Cycle with this process.

Any help in getting the When or suggestiont would be great!
 
So you are trying to make a program which reads all lines in a files and stringsplits them. And then do like a msgbox for every line?

If so you could do something like this:
Code:
Do
	$string = (FileReadLine($file, $i))
	$input = StringSplit($string, ",", 1)
	$i = $i + 1
Until $i = $lines
 
Last edited:
Back
Top