EasyManua.ls Logo

VMware THINAPP 4.6 - Add a Value to the System Registry

VMware THINAPP 4.6
146 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
ThinApp User’s Guide
118 VMware, Inc.
ThinAppsetsupTS_ORIGINtoindicatethefullpathtoacapturedexecutablefilepackage.Avirtual
applicationsetstheTS_ORIGINvariabletothephysicalpathoftheprimarydatacontainer.Ifyouhaveavirtual
applicationconsistingofthemain.exeandshortcut.exefiles,bothfilesresideinC:\VirtApp.Whenyou
runthemain.exefile,TS_ORIGIN varissettoC:\VirtApp\main.exe.Whenyouruntheshortcut.exefile,
theTS_ORIGINenvironmentvariableissettoC:\VirtApp\main.exe.Theenvironmentvariableisalwaysset
totheprimarydatacontainer,evenwhenyoucreateashortcut.WhenyourunVBScriptsthatareincludedin
thepackage,
thevariableisalreadysetandavailabletothescripts.
Origin = GetEnvironmentVariable("TS_ORIGIN")
YoucanseparatethefilenamefromTS_ORIGINbyfindingthelastbackslashandremovingallofthecharacters
followingit.
LastSlash = InStrRev(Origin, "\")
SourcePath = Left(Origin, LastSlash)
Thesourcefiletocopyintothevirtualenvironmentisthepackagepathplusconfig.ini.
SourceFile = SourcePath + "Config.ini"
ThelocationtocopytomightbeadifferentlocationondifferentcomputersiftheProgram Filesdirectoryis
mappedtoalocationotherthanC:\.ThefollowingcallletsThinAppexpandamacrotoobtainthecorrect
locationforthelocalcomputer.
DestFile = ExpandPath("%ProgramFilesDir%\MyApplication\Config.ini")
UsethefilesystemObjectparametertocheckthesourcefileexists.
Set objFSO = CreateObject("Scripting.filesystemObject")
If objFSO.FileExists(SourceFile) Then
Ifthesourcefileexists,copyitintothevirtualfilesystem.The%ProgramFilesDir%\MyApplicationvirtual
directoryisinthepackage.
objFSO.CopyFile SourceFile, DestFile, TRUE
End if
End Function
Add a Value to the System Registry
Thisscriptprocedureaddsavaluetothephysicalsystemregistry.
Add a value to the system registry
1 Createa.regfileandruntheregedit /scommandasanexternalprocessthataccessesthesystem
registryinsteadofthevirtualregistry.
Function OnFirstParentStart
2 Createthe.regfileinalocationthathastheIsolationModeparametersettoMergedsothatthevirtual
environmentcanaccessitwiththisscriptandthephysicalenvironmentcanitwiththeregedit /s
command.
RegFileName = ExpandPath("%Personal%\thin.reg")
Set fso = CreateObject("Scripting.filesystemObject")
Set RegFile = fso.CreateTextFile(RegFileName, true)
The%Personal%directoryisadirectorythathasMergedisolationmodebydefault.
3Constructthe.regfile.
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

Table of Contents

Related product manuals