C H A P T E R 2
Getting Started
2-6
Package Loading, Activation, and Deactivation
IMPORTANT
Any changes that you make to the system in the
InstallScript
function must be reversed in the
RemoveScript
function. For example, if you register your
application for certain system services or install print formats,
stationery, or other objects in the system, you must reverse
these changes and remove or unregister these objects in the
RemoveScript
function. If you fail to do this, such changes
cannot be removed by the user, and if your application is on a
card, they won't be able to remove the card without getting a
warning message to put the card back.
Only applications and auto parts use the
InstallScript
function. Note that the
InstallScript
function takes one extra argument when used for an auto part.
Applications built using the NewtApp framework require special
InstallScript
and
RemoveScript
functions. For details, see Chapter 4,
"NewtApp Applications."
Deactivation
2
The
RemoveScript
function in a package part is executed when an application or
auto part is deactivated.
This function lets you perform any special deinstallation operations that you need
to do, any clean-up, and any unregistration for system services that you registered
for in the
InstallScript
function.
Note that automatically removed auto parts do not use the
RemoveScript
function since such auto parts are removed immediately after the
InstallScript
is executed--the
RemoveScript
is not executed.
In addition to the
RemoveScript
function, another function,
DeletionScript
,
is executed when the user removes a package by deleting it from the Extras
Drawer. This function applies to all types of frame parts, and is actually executed
before the
RemoveScript
function.
The
DeletionScript
function is optional. It lets you do different clean-up
based on the assumption that the user is permanently deleting a package, rather
than simply ejecting the card on which it happens to reside. For example, in the
DeletionScript
function, you might want to delete all the soups created by the
application--checking with the user, of course, before performing such an
irreversible operation.