Results 1 to 17 of 17

Thread: How to: run script from another script.

  1. #1
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default How to: run script from another script.

    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:

    Code:
    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:

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

    Done.

  2. #2
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    I knew there was a way to execute command-line code from within Simba.

    Much rep for you, bg5.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  3. #3
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Heya,

    Here's another way to do it using TProcess;

    Simba Code:
    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

  4. #4
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by Home View Post
    Heya,

    Here's another way to do it using TProcess;

    Simba Code:
    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.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  5. #5
    Join Date
    May 2015
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Thanks for sharing guys, repped!
    -- My FIRST Script: --


  6. #6
    Join Date
    Mar 2015
    Posts
    28
    Mentioned
    1 Post(s)
    Quoted
    13 Post(s)

    Default

    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

  7. #7
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Quote Originally Posted by Clownhair View Post
    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)

    Forum account issues? Please send me a PM

  8. #8
    Join Date
    Mar 2015
    Posts
    28
    Mentioned
    1 Post(s)
    Quoted
    13 Post(s)

    Default

    Quote Originally Posted by Justin View Post
    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:

    Code:
    @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)

  9. #9
    Join Date
    Apr 2015
    Location
    I dont know in front of my window is a wall
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    13 Post(s)

    Default

    Hey,

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

    Thank you all

  10. #10
    Join Date
    Mar 2015
    Posts
    28
    Mentioned
    1 Post(s)
    Quoted
    13 Post(s)

    Default

    Quote Originally Posted by klopfie View Post
    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

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

  11. #11
    Join Date
    Dec 2010
    Posts
    483
    Mentioned
    30 Post(s)
    Quoted
    328 Post(s)

    Default

    Quote Originally Posted by Justin View Post
    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.

  12. #12
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Quote Originally Posted by the bank View Post
    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

    Forum account issues? Please send me a PM

  13. #13
    Join Date
    Dec 2010
    Posts
    483
    Mentioned
    30 Post(s)
    Quoted
    328 Post(s)

    Default

    Quote Originally Posted by Justin View Post
    [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.

  14. #14
    Join Date
    Mar 2015
    Posts
    438
    Mentioned
    21 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by the bank View Post
    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!

  15. #15
    Join Date
    Jul 2015
    Posts
    80
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Im finding here everything i need, thanks a lot

  16. #16
    Join Date
    Mar 2017
    Posts
    32
    Mentioned
    1 Post(s)
    Quoted
    10 Post(s)

    Default

    this is really handy! thank you

  17. #17
    Join Date
    Aug 2019
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanks for sharing this post

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •