PDA

View Full Version : How to: run script from another script.



bg5
09-22-2015, 05:37 PM
I saw some questions on it, so here is an easy guide:

Firstly, you need to make a .bat file. Edit it and paste this, of course change pathes and file names to yours:


C:\Simba5\Simba.1.1.rc4.exe -o "C:\Simba5\Scripts\my_script_to_run.simba" -r

Then, to run it, put in your script:

OpenWebPage('C:\Users\user\Desktop\scriptRun.bat') ;

Done.

KeepBotting
09-22-2015, 06:08 PM
I knew there was a way to execute command-line code from within Simba.

Much rep for you, bg5.

Home
09-22-2015, 06:17 PM
Heya,

Here's another way to do it using TProcess;

var
TProc: TProcess;
FilePath, Args: string;
begin
FilePath := 'C:\Simba\Scripts\Test.simba';
Args := '/c ' + AppPath + 'Simba.exe' + ' -o ' + '"' + FilePath + '"' + ' -r';
if not FileExists(FilePath) then
exit;
TProc.Init(nil);
TProc.setExecutable('Cmd.exe');
TProc.getParameters().Add(Args);
TProc.Execute();
TProc.Free();
end.

~Home

KeepBotting
09-22-2015, 06:22 PM
Heya,

Here's another way to do it using TProcess;

var
TProc: TProcess;
FilePath, Args: string;
begin
FilePath := 'C:\Simba\Scripts\Test.simba';
Args := '/c ' + AppPath + 'Simba.exe' + ' -o ' + '"' + FilePath + '"' + ' -r';
if not FileExists(FilePath) then
exit;
TProc.Init(nil);
TProc.setExecutable('Cmd.exe');
TProc.getParameters().Add(Args);
TProc.Execute();
TProc.Free();
end.

~Home

You get a rep! You get a rep!

Everybody gets rep!

This is seriously cool.

wallie018
09-24-2015, 09:30 AM
Thanks for sharing guys, repped!

Clownhair
10-21-2015, 09:33 AM
Sry for the late post but I just saw this post and I have some questions about this.

I figured this about a while back through another thread but started my own thread to get some extra information about it, however nobody responsed that knew the answer so maybe one of you does:

Your code: C:\Simba5\Simba.1.1.rc4.exe -o "C:\Simba5\Scripts\my_script_to_run.simba" -r

Any idea if there is a way to make it so the simba.exe starts -> sleeps 5s -> runs script (so it has time to load in fonts/libraries on slow pc). So bassicly any documentation about extra parameters that can be added besides -o & -r

Thanks in advance

Gratz
Clownhair

Justin
12-30-2015, 12:59 AM
Sry for the late post but I just saw this post and I have some questions about this.

I figured this about a while back through another thread but started my own thread to get some extra information about it, however nobody responsed that knew the answer so maybe one of you does:

Your code: C:\Simba5\Simba.1.1.rc4.exe -o "C:\Simba5\Scripts\my_script_to_run.simba" -r

Any idea if there is a way to make it so the simba.exe starts -> sleeps 5s -> runs script (so it has time to load in fonts/libraries on slow pc). So bassicly any documentation about extra parameters that can be added besides -o & -r

Thanks in advance

Gratz
Clownhair

I believe Olly; made a Simba version with codehints ect stripped out of it (meaning it was purely for running scripts only and not developing them using it)

Clownhair
12-31-2015, 10:43 AM
I believe Olly; made a Simba version with codehints ect stripped out of it (meaning it was purely for running scripts only and not developing them using it)

Do you by chance have a link for this as I can't seem to find it after a quick search?

However for the people wondering about my initial problem i fixed it with some shell commands:



@if (@CodeSection == @Batch) @then
@echo off

set SendKeys=CScript //nologo //E:JScript "%~F0"

start C:/Simba/simba.exe -o C:/Simba/scripts/yourscripthere.simba
timeout /t 10

%SendKeys% "{F9}"

goto :EOF

@end

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));



So now it fires up Simba with the selected script.
Sleeps for 10 sec
Sends the F9 key to the simba client (F9 is shortcut for run)

klopfie
02-09-2016, 02:03 PM
Hey,

did anybody know how to start simba scipts with c# ?

Thank you all

Clownhair
02-09-2016, 02:11 PM
Hey,

did anybody know how to start simba scipts with c# ?

Thank you all

On windows this works to start up the a batch file


System.Diagnostics.Process.Start("c:\\batchfilename.bat");

the bank
02-09-2016, 02:17 PM
I believe Olly; made a Simba version with codehints ect stripped out of it (meaning it was purely for running scripts only and not developing them using it)

I may be mistaken, but unless he made a second version, the version you are talking about is actually the exact opposite.

The revision I know of him making was optimized for lape and included a large extension to codehints to work with member functions, overrides etc.

I believe he recently took it down off his dropbox, and I can't find the topic right now. I should still have it around somewhere.

Justin
02-10-2016, 07:26 AM
I may be mistaken, but unless he made a second version, the version you are talking about is actually the exact opposite.

The revision I know of him making was optimized for lape and included a large extension to codehints to work with member functions, overrides etc.

I believe he recently took it down off his dropbox, and I can't find the topic right now. I should still have it around somewhere.

[18/01/2015 6:17:50 PM] Olly: no, because it's just gonna sleep in that while nothing else happens
[18/01/2015 6:25:55 PM] *** Olly sent file: Simba.exe ***
[18/01/2015 6:26:04 PM] Olly: try that one if you just want to run a script
[18/01/2015 6:26:09 PM] Olly: it has no ci/functionlist filling
[18/01/2015 6:26:16 PM] Justin: yeah that's fine

The Simba he sent never went public IIRC

the bank
02-10-2016, 12:46 PM
[18/01/2015 6:17:50 PM] Olly: no, because it's just gonna sleep in that while nothing else happens
[18/01/2015 6:25:55 PM] *** Olly sent file: Simba.exe ***
[18/01/2015 6:26:04 PM] Olly: try that one if you just want to run a script
[18/01/2015 6:26:09 PM] Olly: it has no ci/functionlist filling
[18/01/2015 6:26:16 PM] Justin: yeah that's fine

The Simba he sent never went public IIRC

Very cool :) would have been very useful especially when Lape was causing all sorts of crashes before due to CI.

Clutch
02-15-2016, 04:11 AM
Very cool :) would have been very useful especially when Lape was causing all sorts of crashes before due to CI.

Hell, this is exactly what I was looking for! Repped!

guerr
03-18-2016, 12:37 PM
Im finding here everything i need, thanks a lot ;)

ccesssu
09-27-2017, 09:43 PM
this is really handy! thank you

artvilla1000
08-24-2019, 06:54 AM
Thanks for sharing this post