Implement Scripts In A Thinapp Environment; .Bat Example; Timeout Example - VMware THINAPP 4.6 Manual

Hide thumbs Also See for THINAPP 4.6:
Table of Contents

Advertisement

ThinApp User's Guide
The following callback example shows the OnFirstSandboxOwner and OnFirstParentExit functions.
------------------------example.vbs ---------------------------------
Function OnFirstSandboxOwner
msgbox "The sandbox owner is: " + GetCurrentProcessName
End Function
Function OnFirstParentExit
msgbox "Quiting application: " + GetCurrentProcessName
End Function
msgbox "This code will execute for all parent and child processes"
---------------------------------------------------------------------

Implement Scripts in a ThinApp Environment

You might implement a script in the following circumstances:
Timing out an application on a specific date.
Running a .bat file from a network share inside the virtual environment.
Modifying the virtual registry.
Importing the .reg file at runtime.
Stopping a virtual service when the main application quits.
Copying an external system configuration file into the virtual environment on startup.
Implement a script
1
Save the script contents in a plain text file with the .vbs extension in the same directory as your 
Package.ini file.
You can use any filename. ThinApp adds all .vbs files to the package at build time.
2
Rebuild the application.

.bat Example

The following script runs an external .bat file from a network share inside the virtual environment. The .bat 
file makes modifications to the virtual environment by copying files, deleting files, or applying registry 
changes using regedit /s regfile.reg. Run this script only for the first parent process. If you run this script 
for other processes, each copy of the cmd.exe utility runs the script and an infinite recursion develops. 
Function OnFirstParentStart
Set Shell = CreateObject("Wscript.Shell")
Shell.Run "\\jcdesk2\test\test.bat"
End Function

Timeout Example

The following script prevents the use of an application after a specified date. The VBS date uses the 
#mm/dd/yyyy# format, regardless of locale.
This check occurs upon startup of the parent process and any child processes.
if Date >= #03/20/2007# then
msgbox "This application has expired, please contact Administrator"
ExitProcess 0
end if
116
VMware, Inc.

Advertisement

Table of Contents
loading

Table of Contents