EasyManua.ls Logo

VMware THINAPP 4.6 - Implement Scripts in a Thinapp Environment; .Bat Example; Timeout Example

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
116 VMware, Inc.
ThefollowingcallbackexampleshowstheOnFirstSandboxOwnerandOnFirstParentExitfunctions.
------------------------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
Youmightimplementascriptinthefollowingcircumstances:
Timingoutanapplicationonaspecificdate.
Runninga.batfilefromanetworkshareinsidethevirtualenvironment.
Modifyingthevirtualregistry.
Importingthe.regfileatruntime.
Stoppingavirtualservicewhenthemainapplicationquits.
Copyinganexternalsystemconfigurationfileintothevirtualenvironmentonstartup.
Implement a script
1 Savethescriptcontentsinaplaintextfilewiththe.vbsextensioninthesamedirectoryasyour
Package.inifile.
Youcanuseanyfilename.ThinAppaddsall.vbsfilestothepackageatbuildtime.
2Rebuildtheapplication.
.bat Example
Thefollowingscriptrunsanexternal.batfilefrom anetworkshareinsidethevirtualenvironment.The .bat
filemakesmodificationstothevirtualenvironmentbycopyingfiles,deletingfiles,orapplyingregistry
changesusingregedit /s regfile.reg.Runthisscriptonlyforthefirstparentprocess.Ifyourunthisscript
for
otherprocesses,eachcopyofthecmd.exeutilityrunsthescriptandaninfiniterecursiondevelops.
Function OnFirstParentStart
Set Shell = CreateObject("Wscript.Shell")
Shell.Run "\\jcdesk2\test\test.bat"
End Function
Timeout Example
Thefollowingscriptpreventstheuseofanapplicationafteraspecifieddate.TheVBSdateusesthe
#mm/dd/yyyy#format,regardlessoflocale.
Thischeckoccursuponstartupoftheparentprocessandanychildprocesses.
if Date >= #03/20/2007# then
msgbox "This application has expired, please contact Administrator"
ExitProcess 0
end if

Table of Contents

Related product manuals