Results 1 to 6 of 6

Thread: About using NSIS

  1. #1

    About using NSIS

    Hi! I'm new here, I just found ThinBasic few days ago and my first impression was "great job"! It's a nice programming tool, reminds me some Visual Basic 6 (even if it's not a RAD (yet... but why not turn it into a powerful RAD?)...

    I tried the "ThinBundle", and the first lack I saw is the possibility to add a custom icon (sorry, but the default icon is quite ugly under Windows Vista).

    I would like to share my method here. Using NSIS is a possibility. This program was designed to create setups for programs, but it can also be used to create standalone executables for interpreted programming languages like ThinBasic.

    You can get it here if you don't know it.

    http://nsis.sourceforge.net/Main_Page

    The first thing to do is to collect all the required files and place it in the same directory as the script. For a UI program, you need :

    thinbasic.exe
    thincore.dll
    zlib.dll
    thinbasic_ui.dll
    your script (tbasic or tbasicx).

    And here is my NSIS script (creates an exe with icon, version info and even a splash screen... no less, no more!) :

    Name 'ThinBasic EXE'
    Icon 'icon.ico'
    
    OutFile 'out.exe'
    SilentInstall silent
    
    VIProductVersion "1.0.0.0"
    
    VIAddVersionKey "ProductName" "ThinBasic Test"
    VIAddVersionKey "Comments" "Just a test"
    VIAddVersionKey "CompanyName" "Rocco"
    VIAddVersionKey "LegalTrademarks" ""
    VIAddVersionKey "LegalCopyright" "© Rocco"
    VIAddVersionKey "FileDescription" "ThinBasic Test"
    VIAddVersionKey "FileVersion" "1.0.0"
    
    Function .onInit
    	InitPluginsDir
    	SetOutPath $PLUGINSDIR
    	; Splash
    	File 'splash.bmp'
    	advsplash::show 2000 500 1500 -1 $PLUGINSDIR\splash
    
    	Delete $TEMP\splash.bmp
    FunctionEnd
    
    Section "Executable"
    
    	; Required files
    	SetOutPath $PLUGINSDIR
    	File 'test.tbasicx'
    	File 'thinbasic.exe'
    	File 'thincore.dll'
    	File 'zlib.dll'
    
    	; Extra DLLs
    	File 'thinbasic_ui.dll'
    
    	ExecWait '"$PLUGINSDIR\thinbasic.exe" "$PLUGINSDIR\test.tbasicx"'
    SectionEnd
    
    Some explanations :

    It extracts in the temp directory (PLUGINSDIR means a temporary directory under %temp%).

    To compile it, just right click and choose "Compile...".

    NSIS is also easy to learn, and can handle even the most complex deployment scenarios. Experiment!
    There is no bad programming language - only bad programmers

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: About using NSIS

    Thanks for the tip and welcome here!

    The changeable icon for bundles is in the road plan, but the developer for bundle has changed quite recently so it takes some time to incorporate the additions.

    Regarding your proposal - is the %temp% directory named randomly? I am asking just because I wonder if it allows running multiple instances of the "NSIS Bundle".
    That means - if I click 3 times on the icon of the created exe, will it run 3 independent copies of it, or is it single instance only?


    Thank you,
    Petr

    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3

    Re: About using NSIS

    I forgot two lines in the script above, the first is a mistake, change

    Delete $TEMP\splash.bmp
    
    to
    Delete $PLUGINSDIR\splash.bmp
    
    And after the "ExecWait...", add

    SetOutPath $TEMP
    
    Adding this line will delete the temp folder that was created.

    To answer your question, yes, it creates an unique folder in the %temp% directory. For example, I start the .exe and it creates "%temp%\nsl44.tmp" to extract files, and if I start it again, another folder "%temp%\nsm46.tmp".

    There's also a possibility in NSIS to get a random file name, using "GetTempFileName" function. You can customize all the "installation" process.

    To help creating .exe this way, we could create a ThinBasic GUI that calls NSIS and automatically compiles.
    There is no bad programming language - only bad programmers

  4. #4

    Re: About using NSIS

    Hello Rocco,

    welcome to the forum.

    Your NSIS tool looks nice. I am sure once Eros has time he will look into this.

    Best wishes
    Michael Hartlef

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: About using NSIS

    Ciao Rocco and welcome to thinBasic community forum.
    For sure I will check your suggestion and see if it can be a viable solution for thinBasic.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6

    Re: About using NSIS

    Ciao Eros, of course it's a temporary solution until a true "ThinBundle" with version info, icons will be available. But it does the work and the possibilities seems greater for now.



    There is no bad programming language - only bad programmers

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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