g4c.gif (4296 bytes)
For Windows 95/98/Me/NT/2000/XP

 

GCBundler

Thanks to "PackSetup2", a great utility by Lucian Wischik, you can "compile" Gui4Cli scripts into self running executables which behave (on the outside) much like a real win32 executable. To differentiate from the original PackSetup2 utility, this slightly altered version is called "GCBundler".

Latest news..
gcBundler is now included in the main Gui4Cli distribution in DLL form (Pack.dll) allowing you to bundle, zip and unzip files.


How it works:

GCBundler will take a directory, zip it up into one file and create a self extracting executable. When this executable is run, it will unzip its contents into a temporary directory in the users system and run either "Start.bat", or if not available, "Start.exe" (one of which must be included in the dir).

If you use "Start.bat", you are free to do what you want - you could also use the gcLoad binary instead of Gui4Cli, to save on space.

If you use "Start.exe", you must also include a file called "Start.txt" defining the program (Gui4Cli.exe) and the command line to run. These will be launched and then Start.exe will wait around until Gui4Cli exits, whereupon it will delete all files in the directory, and create and run a batch file to clean up itself and the temporary directory.


Download all needed files - gcBundler.zip

  • This download includes "GCBundler.exe" (slightly altered version of PackSetup2.exe - see below), "Start.exe", Start.txt sample file and this help file.

Detailed usage:

  • Bundling (or "compiling") scripts:

To bundle scripts you must first create a directory and put into it the following files:

  1. Start.bat or Start.exe (included in the above archive)
  2. Start.txt (if you use Start.exe - see below)
  3. Gui4Cli.exe
  4. Gui4Cli.exe.manifest (for XP, ignored by others)
  5. Any DLLs your script may use
  6. Your scripts, images and all other files.You can also have subdirectories.

When ready, run PackSetup.exe, choose the above directory as the directory to be packaged up and give the name you want your executable to have. The resulting executable will be about 270k or so (unless you include many images, dlls, etc)

  • Running the executables:

The executable can be run like a normal exe file. Behind the scenes, it will unpack its load into a temporary directory and (if Start.bat is not found) will run "Start.exe". Start.exe, in turn, will look for a file called "Start.txt" and run the command line stated therein. The Start.txt file is a text file with the following format:

Gui4Cli.exe
-instance #NEW guiname.gui

Empty lines and line starting with ";" are discarded.

The 1st actual line must be the name of the program to run - in this case Gui4Cli.exe.

The 2nd line must be the command line - ie any valid Gui4Cli commandline. Note that in this case we use "-instance #NEW" to tell Gui4Cli to start a new instance. You should always do this, unless you have some special reason not to. If you don't and the default instance is running, the gui will be passed to it and the Gui4Cli.exe that you started will quit immediately which will cause Start.exe to clean-up all files, so basically.. all hell will break loose.

Optionally you can also give the NOWAIT keyword, alone, on its own line. Normally, after "Start.exe" launches Gui4Cli it will not quit, but will wait around until Gui4Cli exits again (after the user finishes playing with your program), whereupon it will clean-up (see below). If you give NOWAIT, "Start.exe" will not wait, but will quit immediately, without deleting any files. You must of course arrange some other way to delete them.

  • Clean-up:

After Gui4Cli exits, "Start.exe" will delete all files in the directory and create and run a batch file which will delete Start.exe, the temporary directory and itself. End result is a full clean up without the need for a re-boot.

For safety, the "/S" (for Silent) command-line switch has been added to "Start.exe". If this is not given Start.exe will use a message box get confirmation from the user before deleting all the files. When packed up in an executable, this command line switch will be given automatically, so all files will be deleted silently.

If you use "Start.bat" you must arrange the cleanup yourself.

  • Exe path:

When the executable is unpacked into the temporary directory, a small file will also be created, called "exe_path.txt". This will contain the path that the executable resides in. This is usefull if you need, for example, to save an ini file, or some other data. You can not save this in the temporary directory because it will be deleted, so you must save it in the same directory as the executable (or, if its small, in the registry)

  • Gui4Cli command lines:

As described above, you should always give "-instance #NEW" (or some name of your own) to start a new instance of Gui4Cli. Apart from that you may also want to also look at the "NOICON" and "NOPREFS" command line options that will make your program behave more like a real app. You must remember to quit Gui4Cli in the end though, using the QUIT command.


Note:

Note that you can use the above method with any program - not just Gui4Cli. Start.bat or the Start.txt file allow you to define any program and any command line, so you're basically free to do what you want.

GCBundler Notes:

The "GCBundler" version included in the download above, is the same as the "PackSetup2" utility found on Lucian's site, with the following changes:

  • In the GCBundler (PackSetup2) part
    • Added code to handle sub-directories.
    • Added some more error reporting
    • Changed the name of the starting executable to "Start.exe"
  • In the BaseInstaller part (ie the exe with the embeded zip file)
    • Removed the progress indicator while unpacking.
    • It will quit right after it unpacks the files and runs Start.exe. It will not wait for Start.exe to finish and will not delete any files. This is now done by Start.exe.
    • Extracted files had their read-only attribute set. This caused problems when deleting them so now their attributes are set normal.
    • Added code to handle sub-directories
    • Will save executable path as text file

Code for the original "PackSetup2" is found on Lucian's site.
The source code for Start.exe.


Changes:

13/9/03 - Changed the name of the start-up executable from "Setup.exe" to "Start.exe". The reason is that Windows XP, when the user has a limited account, if the executable is called "Setup.exe" a requester will pop-up asking you if you want to install the program. Renaming everything to "Start.exe", "Start.bat" and "Start.txt" has solved this problem.

Home | Description | Download | Beta | Res | DLLs | Gui Galleria
© Dimitris Keletsekis - 2003