
Originally Posted by
Terror Factor
Hi,
I'm currently having a problem with a script I wrote. It fills in a form and submits it to a website, but the info it submits, is in 4 seperate arrays. All 4 arrays have about 5000 entries. This is too much for my old pc to handle well. My dual core takes about 60s to compile the script, and my pentium 4 can't even compile it most of the time, scar just crashes.
Now, I wondered if I could store the info in a textfile or an excel, and let scar load that file, and get the info from there. Is it possible to load info from a file, AND address it?
I now use something like
Code:
SendKeys(Array[i]);
I should be able to get a specific line from a textfile or an excel, something like this:
Code:
SendKeys(LineOfTextFile[i]);
or
Code:
SendKeys(Row[i],Column[y]);
Can I do something like that, and how? And if not, what other solution could I use? Copy-pasting from excel results quickly in errors, I'm afraid

ReadINI() and WriteINI() should work just fine.
E: This is what i did:
SCAR Code:
program TheFile;
function ReadTheFile( PathToFile: String; I: Integer ): String;
var S: String;
F: Integer;
TheArray: Array of String;
begin
F := OpenFile( PathToFile, False );
ReadFileString( F, S, FileSize( F ) );
CloseFile( F );
TheArray := Explode( ';', S );
Result := TheArray[ I ];
end;
function WriteTheFile( PathToFile, NewString: String; I: Integer ): Boolean;
var S, TheString: String;
F, O: Integer;
TheArray: Array of String;
begin
TheString := '';
F := OpenFile( PathToFile, False );
ReadFileString( F, S, FileSize( F ) );
CloseFile( F );
TheArray := Explode( ';', S );
TheArray[ I ] := NewString;
for O := 0 to GetArrayLength( TheArray ) - 1 do
begin
if not ( O = 0 ) then begin
TheArray[ O ] := ';' + TheArray[ O ];
end;
TheString := TheString + TheArray[ O ];
end;
F := RewriteFile( PathToFile, False );
WriteFileString( F, TheString );
CloseFile( F );
Result := True;
end;
begin
Writeln( ReadTheFile( ScriptPath + 'test.txt', 0 ) );
Writeln( ReadTheFile( ScriptPath + 'test.txt', 1 ) );
Writeln( ReadTheFile( ScriptPath + 'test.txt', 2 ) );
WriteTheFile( ScriptPath + 'test.txt', 'usernametest', 0 );
Writeln( ReadTheFile( ScriptPath + 'test.txt', 0 ) );
WriteTheFile( ScriptPath + 'test.txt', 'passwordtest', 1 );
Writeln( ReadTheFile( ScriptPath + 'test.txt', 1 ) );
WriteTheFile( ScriptPath + 'test.txt', 'pintest', 2 );
Writeln( ReadTheFile( ScriptPath + 'test.txt', 2 ) );
end.
{OUTPUT:
Successfully compiled (25 ms)
username
password
pin
usernametest
passwordtest
pintest
Successfully executed
FILE:
username;password;pin
}