VMware, Inc.
115
9
Scripts
modify
the
behavior
of
virtual
applications
dynamically.
You
can
create
custom
code
before
starting
an
application
packaged
with
ThinApp
or
after
an
application
exits.
You
can
use
scripts
to
authenticate
users
and
load
configuration
files
from
a
physical
to
virtual
environment.
Callback
functions
run
code
during
specific
events.
If
applications
create
child
processes,
use
callback
functions
to
run
code
only
in
the
main
parent
process.
API
functions
run
ThinApp
functions
and
interact
with
the
ThinApp
runtime.
API
functions
can
authenticate
users
and
prevent
the
start
of
applications
for
unauthorized
users.
Adding
scripts
to
your
application
involves
creating
an
ANSI
text
file
with
the
.vbs
file
extension
in
the
root
application
project
directory.
The
root
project
directory
is
the
same
directory
that
contains
the
Package.ini
file.
During
the
build
process,
ThinApp
adds
the
script
files
to
the
executable
file
and
runs
each
of
the
script
files
at
runtime.
ThinApp
uses
VBScript
to
run
script
files.
For
information
about
VBScript,
see
the
Microsoft
VBScript
documentation.
You
can
use
VBScript
to
access
COM
controls
registered
on
the
host
system
or
within
the
virtual
package.
This
information
includes
the
following
topics:
“Callback
Functions”
on
page 115
“Implement
Scripts
in
a
ThinApp
Environment”
on
page 116
“API
Functions”
on
page 119
Callback Functions
Callback
functions
can
run
under
certain
conditions.
For example,
callback
functions
run
script
code
only
when
an
application
starts
or
quits.
Callback
function
names
include
the
following
names:
OnFirstSandboxOwner
–
Called
only
when
an
application
first
locks
the
sandbox.
This
callback
is
not
called
if
a
second
copy
of
the
same
application
uses
the
same
sandbox
while
the
first
copy
runs.
If
the
first
application
spawns
a
subprocess
and
quits,
the
second
subprocess
locks
the
sandbox
and
prevents
this
callback
from
running
until
all
subprocesses
quit
and
the
application
runs
again.
OnFirstParentStart
–
Called
before
running
a
ThinApp
executable
file
regardless
of
whether
the
sandbox
is
simutaneously
owned
by
another
captured
executable
file.
OnFirstParentExit
–
Called
when
the
first
parent
process
exits.
If
a
parent
process
runs
a
child
process
and
quits,
this
callback
is
called
even
if
the
child
process
continues
to
run.
OnLastProcessExit
–
Called
when
the
last
process
owning
the
sandbox
exits.
If a
parent
process
runs
a
child
process
and
quits,
this
callback
is
called
when
the
last
child
process
exits.
Creating ThinApp Scripts
9
Summary of Contents for THINAPP 4.6 - MIGRATING APPLICATIONS TECHNICAL NOTE
Page 38: ...ThinApp User s Guide 38 VMware Inc...
Page 114: ...ThinApp User s Guide 114 VMware Inc...
Page 136: ...ThinApp User s Guide 136 VMware Inc...