I recently purchased Sapien Primal Script 2011. It is a fine piece of software. In my case, however, I tend to write a lot of my scripts using Kixtart. The unfortunate detail is that PrimalScript, does not natively support (exe) script packaging. The good news is that it does, in fact, support adding external tools to it.

There is a 3rd party free utility called Kix2Exe which has a slick interface for making your Kix scripts into fully packaged exe. For the record, Admin Script Editor, by iTripoli does that natively, but I had been a little unhappy with the infrequency of updates, and regular crashes.

In this article, I will be walking you through the steps to integrate, as seamlessly as possible Kix2Exe with Primal Script Editor, in order to package all your scripts from within the editor itself.

  1.  Go to http://kix2exe.ramonitor.nl/howtoinstall.phpand follow the installation instructions for installing Kix2Exe and Kix2Exe Gui. It’s fairly straightforward. I would recommend that you also add the path to Kix2Exe to your %PATH% variable.
    Set PATH=%PATH%;C:\Program Files\Kix2Exe

    Of course, if you want this to stick, you might want to add it from My Computer -> Properties – > Environment Variables -> System Variables, and modify the value of the “PATH” variable.

  2. Open up PrimalScript 2011, and open up the Tools Browser: View -> Browser Panels -> Tools Browser
  3. Create a new tool inside an existing group or a new group of your preference
    Create Kix2Exe Tool
  • Set the “Command Line” to the path of Kix2Exe
  • Set the Arguments to /script $File$ /usescriptsettings
  • Check the “Ask for Arguments” box
  • Check the “Capture Output” box

Obviously, this is based on preference, and if you have a real use for adding parameters in there to be applied to all scripts, then, go ahead and include those in that line. you can find the help for the available parameters on the Kix2Exe site.

In order to initially configure your template, the easiest way to do so, is to open up the Kix2Exe Gui, and go through the settings that you would like, then, after you are done, open up a Kix script with the Kix2exe Gui, and click on “Save Settings”. This will write the options straight into the script, which, you can then save as a template.

In this case, the parameters state that the script to read is the currently open script, and it instructs Kix2Exe to use the embedded Kix2Exe settings. For this to work, I would recommend you create a Kix Template which would include your mostly used settings. The header of your script would look something like this:

;<kix2exe>
;<version>1.4.0.0</version>
;<settings>
;   <package>S:\Test\RunKix.exe</package>
;   <icon></icon>
;   <kix>Kix32</kix>
;   <consolehide></consolehide>
;   <consolesize>300,300</consolesize>
;   <consoletitle>Test Script</consoletitle>
;   <keepconsoleopen></keepconsoleopen>
;   <include>S:\Admin\owexec.exe</include>
;   <runasuser></runasuser>
;   <runaspassword></runaspassword>
;   <runasinteractive></runasinteractive>
;   <runasnoprofile></runasnoprofile>
;   <uaclevel>Admin</uaclevel>
;   <branding-name>Test File Name</branding-name>
;   <branding-desc>This is a test Kixtart Script</branding-desc>
;   <branding-company>Company Name</branding-company>
;   <branding-version>ver</branding-version>
;   <branding-vernum>1.0.0.0</branding-vernum>
;   <branding-prodver>1.0.0.0</branding-prodver>
;   <branding-copyright>Copyright Company Name</branding-copyright>
;   <balloontips>true</balloontips>
;   <kixforms></kixforms>
;</settings>
;</kix2exe>

Notice that I have not included a runasuser, or runaspassword. The reason for this, is so that alternate credentials are not plastered all over the uncompiled scripts. Instead, this is where the “Ask for Arguments” options comes in:

If you want to compile a script with alternate credentials, or for any other options for that matter, and you prefer not to put the option in the script settings, you can always add the corresponding parameter right before running the packager, as you can see in the below screenshot:

From here on out, anytime you want to package a script, you just open up the external tool, and fill in the parameter (if needed), otherwise, the only items that need to be configured with your script, are the ones that are included in your template.

 

Print Friendly
Subscribe By Email for Updates.