Add A Value To The System Registry - VMware THINAPP 4.6 Manual

Hide thumbs Also See for THINAPP 4.6:
Table of Contents

Advertisement

ThinApp User's Guide
ThinApp sets up TS_ORIGIN to indicate the full path to a captured executable file package. A virtual 
application sets the TS_ORIGIN variable to the physical path of the primary data container.If you have a virtual 
application consisting of the main.exe and shortcut.exe files, both files reside in C:\VirtApp. When you 
run the main.exe file, TS_ORIGIN var is set to C:\VirtApp\main.exe. When you run the shortcut.exe file, 
the TS_ORIGIN environment variable is set to C:\VirtApp\main.exe. The environment variable is always set 
to the primary data container, even when you create a shortcut. When you run VBScripts that are included in 
the package, the variable is already set and available to the scripts.
Origin = GetEnvironmentVariable("TS_ORIGIN")
You can separate the filename from TS_ORIGIN by finding the last backslash and removing all of the characters 
following it.
LastSlash = InStrRev(Origin, "\")
SourcePath = Left(Origin, LastSlash)
The source file to copy into the virtual environment is the package path plus config.ini.
SourceFile = SourcePath + "Config.ini"
The location to copy to might be a different location on different computers if the Program Files directory is 
mapped to a location other than C:\. The following call lets ThinApp expand a macro to obtain the correct 
location for the local computer.
DestFile = ExpandPath("%ProgramFilesDir%\MyApplication\Config.ini")
Use the file systemObject parameter to check the source file exists.
Set objFSO = CreateObject("Scripting.filesystemObject")
If objFSO.FileExists(SourceFile) Then
If the source file exists, copy it into the virtual file system. The %ProgramFilesDir%\MyApplication virtual 
directory is in the package.
objFSO.CopyFile SourceFile, DestFile, TRUE
End if
End Function

Add a Value to the System Registry

This script procedure adds a value to the physical system registry.
Add a value to the system registry
1
Create a .reg file and run the regedit /s command as an external process that accesses the system 
registry instead of the virtual registry.
Function OnFirstParentStart
2
Create the .reg file in a location that has the IsolationMode parameter set to Merged so that the virtual 
environment can access it with this script and the physical environment can it with the regedit /s 
command. 
RegFileName = ExpandPath("%Personal%\thin.reg")
Set fso = CreateObject("Scripting.filesystemObject")
Set RegFile = fso.CreateTextFile(RegFileName, true)
The %Personal% directory is a directory that has Merged isolation mode by default.
3
Construct the .reg file.
RegFile.WriteLine("Windows Registry Editor Version 5.00")
RegFile.WriteBlankLines(1)
RegFile.WriteLine("[HKEY_CURRENT_USER\Software\Thinapp\demo]") RegFile.WriteLine(chr(34) and
"InventoryName" and chr(34) and "=" and chr(34) and GetBuildOption("InventoryName") and
chr(34))
RegFile.Close
118
VMware, Inc.

Advertisement

Table of Contents
loading

Table of Contents