Tools - Compile Program


This distinguishing feature of vTask Studio allows you to take a command file and create a standalone program that can be run by itself. The program will be completely self-contained, and will not require any other programs or libraries to run (not even vTask). These capabilities turn vTask into a complete development environment. This is useful for creating utilities with vTask, and then letting other users who may not have vTask run the same commands.

*Tip:  Examples of how to compile EXE files from the command line are provided at the bottom of this page.

When creating a compiled program, you will have the following options available:



*Tip:  You can preset the options for any script: simply include a comment line with the command-line options. This is helpful if you have many scripts, each with different compile settings. A comment such as the following will automatically set the desired options when you compile:


The command line can be obtained from the Compile dialog:  



Screen Item Description
Output File
The name you want the compiled program to have. This will always have an .EXE (executable) extension. You can overwrite another existing program if desired. If the designated EXE program already exists and is running, the compile will fail.
Platform
Windows will create a Win32 application (a standard Windows program)
Console will create a character-based application (like a MS-DOS program)
DLL will create a Dynamic Link Library

If you are unsure of which to pick, choose "Windows". Note that not all options are available for Console and DLL, due the technical restrictions of these platforms.

*Tip:  As a general rule, DLLs should only be used for "processing" type of scripts, rather than user interface actions, due to the shared nature of DLLs. Certain User Interface and Wait actions may not work as expected. Similarly, Console programs are typically not able to show graphical items such as images, since they are character-mode programs.

In these cases, rather than aborting, vTask will continue to compile, but will show a warning message like "WARNING! The selected PLATFORM is not compatible with some actions in "script.vxm". Some steps may not perform correctly."

Icon
Any icon you want may be included in the compiled program. Full-color and multiple device/dimension icons (such as tiles and small icons) are possible. Choose other icons from .ICO, .EXE, or .DLL type files (icon, program, or resource files).

If you want the default icon, check the "Use Default Windows or vTask" option. The default Windows icon saves about 15k due to the size of the high-color vTask icon.
Use Compression for smallest output size
This feature will create the smallest possible EXE file size. It uses compression and an EXE packing method to achieve approximately 50% smaller output size.

If you are experiencing problems when running your EXE, do not use this compression feature.
Package image files inside of program
This option will include externally referenced image files into your program. Only files that physically exist at the time of compile can be embedded. Files that do not exist at the time of compile, or use variables that cannot be expanded, are unable to be embedded.

vTask will attempt to minimize the number of images that are packaged into the EXE, for situations where the same image is reused multiple times (by more than one step in the script). This number of "reused package file links" is reported after the compile.

There are two types of files that can be embedded:

  Image Files

    All actions that use images, such as "Wait for Image" or "Display Image", can use embedded image files. The physical image is stored uncompressed as a resource inside in the compiled EXE.


  Data Files

    The Read File action can read the contents of an embedded data file. By design, this is the only action that utilizes embedded data files, to avoid assumptions about files that may later exist or are dynamically created at run time.

If you want to use embedded data files with other actions, 1) use the Read File action and save the contents of the embedded file into a variable, and then 2) use the Write File to create a new file. In other words, the Read File action acts like an extraction command for embedded data files. This architecture allows complete control over embedded file manipulation.

If an error occurs while embedding, a number of things could be the cause. Here is a list of some of the things that could cause failure while embedding files:
  • Files with a size of 0 cannot be embedded
  • The maximum number of files is already embedded (32)
  • The file is open (or locked) by another process
  • The file is on a network that is not available or is being blocked by the vTask compile process
  • The embedded files are resources, so Windows could have a resource error
  • The language of the file is specifically set to not be allowed in English resources
  • The EXE output is running or locked or otherwise unable to be updated
  • Of course, the obvious things like a non-existent file, or the file contents cannot be accessed/opened.
Single Instance (only run 1 copy at a time)
This option will only allow one copy of the program to run at the same time. When another copy of the EXE is started, it will close if it sees that it is already running.

This feature is important when automatically launching the compiled EXE from a batch file or automated process, and you don't want multiple copies of it running.
Encrypt script source (do not allow decompile)
This option will create an EXE that cannot be read, opened, or decompiled by vTask or any other program. This means that the source script used to create your program can't be viewed by someone using vTask.

Use of this feature also implies that you should always keep a copy of your VXM source script, since the original steps can't be extracted from an encrypted EXE (even by vTask).
Version Information This section allows you to put in custom information that will mark the EXE. This information is then available in Windows Explorer:



You can now do any variation of version numbers:

"5"
"1.2"
"10.0.0.1"
"0.0.0.3"
"1.2.3"
        




  Compiling Executables from the Command Line

vTask has the ability to compile VXM files into EXE programs from the command line, without running the main vTask program itself. This has the advantage of allowing "batch" compiles (many programs at once), and facilitates managing large projects.

There are numerous command line switches that facilitate the setting the compile options:

*Tip:  A command line switch can begin with either a dash (-) or a forward slash (/), therefore "-c" and "/c" are synonymous.


Command Line Switch Purpose Example
-c The source VXM file to compile. This is a required switch. -c C:\MyFile.vxm
-o The output filename -o c:\MyProgram.exe
-icon  (or -i) Sets the icon options
filename for an EXE, DLL, or ICO file that contains an icon
-icon c:\somefile.exe
-compress  (or -z) Activates the Compression option as described in the preceding section. -compress  (no options)
-package_i
-package_d
(or  -pi, -pd)
Packages (embeds) all external image (-pi) and data (-pd) files into the program -pi  (no options)
-single  (or -s) Activates the "run one copy" feature of an EXE as described in the preceding section -single  (no options)
-encrypt  (or -e) The EXE is encrypted so that the original script steps can't be accessed by decompiling the EXE -encrypt  (no options)
-version  (or -v) Sets the Version string -version 1.2
-description  (or -d) Sets the Description string (use single quotes) -description 'This is my program'
-copyright  (or -y) Sets the Copyright string (use single quotes) -copyright 'Copyright © 2009 My Company'
-quiet  (or -q) Supresses all output unless an error occurs -quiet  (no options)
-WIN32 Creates a Windows program (default) -WIN32  (no options)
-CONSOLE Creates an MS-DOS character-based program -CONSOLE  (no options)
-DLL Creates a Windows Dynamic Link Library (DLL) -DLL  (no options)


*Tip:  To easily obtain the complete command line switches needed for a compile, use the vTask "Compile EXE" feature. It has a box which contains the switches being used, which can be copied with the "Copy" button:




Example Compile Lines:

    vTask -c script.vxm
    vTask -c MyFile.vxm -version 1.2
    vTask -c script.vxm -o Demo.exe -icon IconSource.exe
    vTask -c script.vxm -o Demo.exe -single -compress
    vTask -c script.vxm -o Demo.exe -copyright '© 2009'


Sample Compile Output: