locked
Small Basic : Compile RRS feed

  • Question

  • Hi Team,

    I am trying to compile a small basic program for example :- test.sb using command prompt . I tried the following command . It is throwing the following exception. Kindly advise if there is any other solution that I can compile the test.sb file dynamically without using small basic IDE

    Regards,


    Tuesday, September 19, 2017 1:42 PM

Answers

  • First I would try cd to the folder where your SB file is (C:\temp) - it should be somewhere you have write permission, then run the SB compiler with full path within quotes from there.  Reason being you need write access to the current folder here the output will be generated.

    In cmd tool

    cd C:\temp

    "C:\Program Files (x86)\Microsoft\Small Basic\SmallBasicCompiler.exe" test.sb
    • Edited by litdev Tuesday, September 19, 2017 5:32 PM
    • Marked as answer by [Roshan_Kumar] Wednesday, September 20, 2017 2:25 AM
    Tuesday, September 19, 2017 5:27 PM
  • Hi RoshanKumarPriya, I think you can use http://litdev.co.uk/LitDev_LDProcess.html to call Small Basic compiler.

    Nonki Takahashi

    • Marked as answer by [Roshan_Kumar] Wednesday, September 20, 2017 2:48 AM
    Wednesday, September 20, 2017 2:43 AM
  • Some options:

    1] create a batch (*.bat) file with command as in cmd, then call bat file using LDProcess.Start.

    2] Use something maybe like:

    LDProcess.Start("C:\Program Files (x86)\Microsoft\Small Basic\SmallBasicCompiler.exe", "test.sb")
    LDProcess.Start("C:\temp\test.exe","")

    Save and run this from C:\temp.

    3] Try using LDCall.Compile and LDProcess.Start after compiled, also look into LDCall.Include and LDCall.CallInclude if you want.

    LDCall.Compile("C:\temp\test.sb")
    LDProcess.Start("C:\temp\test.exe","")

    or using LDCall.Include:

    LDCall.Compile("C:\temp\test.sb")
    inc = LDCall.Include("C:\temp\test.exe")
    LDCall.CallInclude(inc,"DoIt")

    4] Experiment a bit - this is what SB learning is about.

    My test.sb

    TextWindow.WriteLine("Hello World")
    
    Sub DoIt
      TextWindow.WriteLine("Hello World")
    EndSub



    • Edited by litdev Wednesday, September 20, 2017 5:54 PM
    • Marked as answer by [Roshan_Kumar] Thursday, September 21, 2017 3:01 AM
    Wednesday, September 20, 2017 5:19 PM

All replies

  • First I would try cd to the folder where your SB file is (C:\temp) - it should be somewhere you have write permission, then run the SB compiler with full path within quotes from there.  Reason being you need write access to the current folder here the output will be generated.

    In cmd tool

    cd C:\temp

    "C:\Program Files (x86)\Microsoft\Small Basic\SmallBasicCompiler.exe" test.sb
    • Edited by litdev Tuesday, September 19, 2017 5:32 PM
    • Marked as answer by [Roshan_Kumar] Wednesday, September 20, 2017 2:25 AM
    Tuesday, September 19, 2017 5:27 PM
  • Hi,

    Thanks, Now I could Do That Using Command Prompt.

    Is It Possible To Compile And Run a ".sb" File Using A Small Basic Extension Method, Or Any Other Way?

    Thanks,




    Wednesday, September 20, 2017 2:28 AM
  • Hi RoshanKumarPriya, I think you can use http://litdev.co.uk/LitDev_LDProcess.html to call Small Basic compiler.

    Nonki Takahashi

    • Marked as answer by [Roshan_Kumar] Wednesday, September 20, 2017 2:48 AM
    Wednesday, September 20, 2017 2:43 AM
  • Hi,

    But How To Make It Compile And  Run A Small Basic Program

    Or Is It Possible To Compile And Run a ".sb" File Using A Small Basic Extension Method

    Tried - SPExtra.Compile() Not Working

    Thanks,



    Wednesday, September 20, 2017 2:54 AM
  • Some options:

    1] create a batch (*.bat) file with command as in cmd, then call bat file using LDProcess.Start.

    2] Use something maybe like:

    LDProcess.Start("C:\Program Files (x86)\Microsoft\Small Basic\SmallBasicCompiler.exe", "test.sb")
    LDProcess.Start("C:\temp\test.exe","")

    Save and run this from C:\temp.

    3] Try using LDCall.Compile and LDProcess.Start after compiled, also look into LDCall.Include and LDCall.CallInclude if you want.

    LDCall.Compile("C:\temp\test.sb")
    LDProcess.Start("C:\temp\test.exe","")

    or using LDCall.Include:

    LDCall.Compile("C:\temp\test.sb")
    inc = LDCall.Include("C:\temp\test.exe")
    LDCall.CallInclude(inc,"DoIt")

    4] Experiment a bit - this is what SB learning is about.

    My test.sb

    TextWindow.WriteLine("Hello World")
    
    Sub DoIt
      TextWindow.WriteLine("Hello World")
    EndSub



    • Edited by litdev Wednesday, September 20, 2017 5:54 PM
    • Marked as answer by [Roshan_Kumar] Thursday, September 21, 2017 3:01 AM
    Wednesday, September 20, 2017 5:19 PM