What is Virtual Text?
Previous Topic  Next Topic 

Virtual text is used throughout InstallJammer as a way to define variables within an install and sometimes within the install builder itself.  You will see virtual text throughout your use of InstallJammer as text that is between <% and %>.

Some virtual text is defined by you when you create your project and other virtual text is defined by InstallJammer when it builds your project.  An example of virtual text that you define is the <%AppName%> virtual text which represents the Application Name you filled in when you created your project.  An example of virtual text defined by InstallJammer would be <%InstallMode%> which, during installation, can tell you whether the user chose a Standard, Default or Silent install.

Virtual text is an easy way for InstallJammer to represent variable data within an install, and since it can be nested, virtual text can contain other virtual text that will all be represented when it is used within an install.

Using Virtual Text 

Virtual text can be used almost anywhere in an install, and InstallJammer will automatically substitute the virtual text for its value when it is needed.  To use virtual text, simply use one of the available Virtual Text Definitions between <% and %>.

For example, <%AppName%> when used in a project will be substituted for your Application Name during installation.  <%Platform%> will be substituted for the name of the current platform you're installing on (Windows, Linux-x86, etc...).

Virtual text can be nested inside of another virtual text definition, and InstallJammer will automatically substitute all the values recursively.  This means that if your Application Name contains "My Application <%Version%>" InstallJammer will substitute the <%Version%> recursively inside the virtual text to the value of your application's version.  So, you would get "My Application 1.0" (or whatever your version is).

Arguments in Virtual Text 

Some virtual text fields can also receive arguments that modify the value of the virtual text.  In this case, the virtual text will not be a single word surrounded by <% and %>, but will instead be the first word of the virtual text along with arguments passed after the word.  An example is the <%Date%> virtual text which can be passed with an argument that specifies the format of the date string.  Example:

<%Date %m/%d/%Y%>

This tells InstallJammer to return today's date in format of Month/Day/Four-digit-year.  %m/%d/%Y is an argument passed to the Date virtual text.

Another example:

<%Dir C:\foo\bar forwardslash%>

would return


Boolean Values in Virtual Text 

InstallJammer automatically converts any virtual text value that looks like a boolean into a 0 or 1.  This is mostly to make dealing with booleans simpler, but it's also so that checkbuttons respond accurately to virtual text since checkbuttons expect a 0 or 1 for value and not the various boolean values that are acceptable.  Acceptable boolean values are: 0, false, no, or off or 1, true, yes or on, or any abbreviated or uppercase spellings.

You should always check virtual text variables that are boolean by checking to see if the string is true or false and not a specific string like yes or no.  The String Is Condition is better than a String Equal Condition for boolean values.