From: Olly
It works fine for me, And i just typed it into cmd and it worked. :s
Oh it does work :S wth.. I guess my previous test script had a missing { for the loadlib directive and caused it not to compile/run..
var
ScriptName: String;
TP: TProcess;
begin
ScriptName := 'Test.Simba';
TP.Init(nil);
TP.setCommandLine(ScriptPath + 'Simba.exe -o ' + ScriptPath + 'Scripts\' + ScriptName + ' -r');
TP.Execute();
TP.Free();
end.
Works.. The script I was testing was a script that loaded a plugin and the plugin wasn't found so it did nothing.. If its just regular errors, it shows them.
I thought I was wrong & Simba broke but I guess I got it right after all :D
The above code WILL work but it is still deprecated because .setCommandLine shouldn't be used anymore..
Instead it'd have to be done like:
Function Execute(Application: String; Args: TStringArray = []): Boolean;
var
I: Integer;
Tmp: TProcess;
Begin
Tmp.Init(nil);
Tmp.setExecutable(Application);
For I := 0 To High(Args) Do
Begin
Tmp.getParameters().Add(Args[I]);
End;
Tmp.Execute();
Tmp.Free();
End;
Procedure ExecuteScript(Script: String; Path: String = ScriptPath);
Begin
If (Path = ScriptPath) Then
Path := Path + 'Scripts/';
Execute(ScriptPath + 'Simba.exe', ['-o', Path + Script, '-r']);
End;
begin
ExecuteScript('Test.Simba'); //or ExecuteScript('Test.Simba', 'C:/SomePathToScript/');
end.