Variables

Session variables are special types of variables that are expanded at runtime when they are used. When they are used on screens, their values are automatically expanded for you, however if a session variable is used in an action script, it must be manually expanded using the SessionVar.Expand action.

While there are predefined session variables available to use, you can also create custom session variables at design time and run time. At design time, they can be defined on the Session Variables tab of the Project Settings dialog. At run time, you can create and manipulate session variables using the available SessionVar actions.

Note: If a session variable used on a screen needs to be set to a different value, it must be set prior to the screen's displaying, and all of its events. Another option is to set the text of the screen control using the appropriate Dlg***.SetProperties action. Any changes made to a session variable on a screen after the screen has been created (just before the On Preload event) will have no effect.

Tip: The pre-defined session variables are listed along with all of the actions and constants when you press Ctrl+Space in the action editor. Since all of the session variables start with an percentage character "%", if you type % and then press Ctrl+Space, you'll be taken right to the first session variable in the list.

 

The following pre-defined session variables are available in Visual Patch:

%AppFolder%

The main directory where your application has been located given the specified key files. A folder can be determined as the application folder using the VisualPatch.CheckFolderVersion and VisualPatch.GetTargetVersion actions. This folder path is set through action script generated by you, or automatically generated for you when you use the project wizard.

%ApplicationDataFolder%

The path to the Application Data folder on the user's system. This folder serves as a common repository for application-specific data. Typically, this path is something like "C:\Documents and Settings\YourName\Application Data." On Windows Vista or later, it would return something like "C:\Users\YourName\AppData\Roaming."

%ApplicationDataFolderCommon%

The path to the all-user Application Data folder on the user's system. This folder servers as a common repository for application-specific data. Typically this is something like "C:\Documents and Settings\All Users\Application Data." On Windows Vista or later, this returns "C:\ProgramData."

%CommonFilesFolder%

The user's Common Files folder. Typically, this is something like: C:\Program Files\Common Files.

%CompanyName%

Your company’s name. The value of this variable is set on the Session Variables tab of the Project Settings dialog.

%CompanyURL%

Your company’s URL. The value of this variable is set on the Session Variables tab of the Project Settings dialog.

%Copyright%

The copyright message for your product. The value of this variable is set on the Session Variables tab of the Project Settings dialog.

%DesktopFolder%

The path to the user's Desktop folder. On Windows NT/2000/XP/Vista or later, this is the path from the per-user profile.

%DesktopFolderCommon%

The path to the user's Desktop folder. On Windows NT/2000/XP/Vista or later, this is the path from the All Users profile. On a non-Windows NT system, this will simply be the path to the user's Desktop folder (the same as _DesktopFolder).

%FontsFolder%

The path to the user’s font directory (e.g. "C:\Windows\Fonts").

%MyDocumentsFolder%

The user's personal (My Documents) folder on their system. Usually this is something like "C:\Documents and Settings\YourName\My Documents" on Windows 2000/XP and "C:\My Documents" on Windows 98/ME, and "C:\Users\YourName\Documents" on Windows Vista or later.

Note: Windows 95 did not have the My Documents folder and this variable will return "C:" if run on such a system.

%ProductName%

The name of the product that you are patching. The value of this variable is set on the Session Variables tab of the Project Settings dialog.

%ProgramFilesFolder%

The user's Program Files folder (typically, this is something like "C:\Program Files").

%RegOwner%

The name of the registered user of the system.

%RegOrganization%

The organization of the registered user of the system.

%SourceDrive%

The drive that the patch executable was run from (e.g. "C:" or "D:").

%SourceFolder%

The full path to the folder that the patch executable was run from (e.g. "C:\Downloads" or "D:\").

%SourceFilename%

The full path, including the filename, for the current patch executable.

For example, if the user was running "patch.exe" from "C:\Downloads", %SourceFilename% would be expanded to "C:\Downloads\patch.exe".

%StartFolder%

The path to the user's Start menu folder. On Windows NT/2000/XP/Vista or later, this is the path from the per-user profile.

%StartFolderCommon%

The path to the user's Start menu folder. On Windows NT/2000/XP/Vista or later, this is the path from the All Users profile. On a non-Windows NT system, this will simply be the path to the user's Start menu folder (the same as %StartFolder%).

%StartProgramsFolder%

The path to the Programs folder in the user's Start menu. On Windows NT/2000/XP/Vista or later, this is the path from the per-user profile.

%StartProgramsFolderCommon%

The path to the Programs folder in the user's Start menu. On Windows NT/2000/XP/Vista or later, this is the path from the All Users profile. On a non-Windows NT system, this will simply be the path to the Programs folder in the user's Start menu (the same as %StartProgramsFolder%).

%StartupFolder%

The path to the user's Startup folder. On Windows NT/2000/XP/Vista or later, this is the path from the per-user profile.

%StartupFolderCommon%

The path to the user's Startup folder. On Windows NT/2000/XP/Vista or later, this is the path from the All Users profile. On a non-Windows NT system, this will be the path to the user's Startup folder (the same as %StartupFolder%).

%SystemFolder%

The path to the user’s Windows System folder (e.g. "C:\Windows\System").

%SystemDrive%

The drive that the user's Windows System directory is located on (usually "C:").

%TempFolder%

The path to the user's Temp folder.

%TempLaunchFolder%

The path to the temporary directory where Visual Patch extracts the files it will need for the patch. (For example, this is the directory where Primer files are extracted to.)

Usually this directory will be a subfolder of the user's temporary directory, unless overridden with the /T command line option.

%WindowsFolder%

The path to the user’s Windows folder (e.g. "C:\Windows").

%WindowTitle%

The text that will appear on the windows task bar while the patch is running. The value of this variable is set on the Session Variables tab of the Project Settings dialog.