
The following are a short summary of the various "hooks" that are available to the macro programmer to use to control the flow of CimPACK from startup to shut-down.

=======================================================================================
Our standard Tunefile supports the following options:

#Q\Local\OEMTune.mac
If this exists, it is run with the same -APPINIT argument that tunefile gets.  This is for OEM Vendors - unless you are a value-added reseller of Cimex products, do not mess with this file.
This is run before almost anything else - only the library paths have been set before running this macro.

#Q\Local\Tunefile.mac
If this file exists, it is also run with the same -APPINIT argument as seen by tunefile.  This allows for customer site specific document creation & application startup code.

#T\NEWDOC
If this file exists, and if it contains the name of a macro as it's only contents, then the specified macro is run at this point.

#T\NEWDOC.TMP
If this file exists, it is run at this point (as a macro).

finally, MAINMENU is run (and this is what continues to run for the lifetime of the application)

=======================================================================================
There are several macros that will be called automatically if they exist:

$#Q\Local\
	Tunefile.mac
	PreSave.mac
	PostSave.mac
	PreOpen.mac
	PostOpen.mac
	OpenSave.mac

Simply create a macro with one of the above names in the local folder.  It will be called automatically at a time appropriate to its name (e.g. PreSave.mac is called right before a document is saved).
All of the above macros cannot affect the process of opening or saving, they are merely there to allow extra work to be performed.  There are other macros which can be used to change the basic save or load behaviours.
Note that OpenSave is called before the document is opened, and after it is saved.  Also, param(279) must = 1 in order for OpenSave.mac to be called.

Examples and notes for each hook file follows:

--------------------
  Tunefile.mac
--------------------

- APPINIT

* if appinit is specified, then this instance of cimpack is just starting up - any application-wide initialization should be done now.
* e.g. logging in to a custom database for a specific user might be done at this point.
* whether or not appinit is specified, a new design will be created and possibly loaded from a file, depending on the exe's command-line arguments.
* so any per document chores that need to be done can be done here as well.

--------------------
  PreSave.mac 
--------------------

- AS

* we must take the previous argument (by placing this line first in the file)

* we can then test to see whether we're being called in the context of Save As or just Save using:
if type(#0) = '-'
	* SaveAs
else
	* Save
fi
* we can return 900 if we wish to terminate the open or save

--------------------
  PostSave.mac
--------------------

- EXPORT

* NOTE: EXPORT will be specified if the file was exported instead of saved
*       For example, if the file is saved as a PLT, then EXPORT is specified

* this macro is called automatically after each save operation
* if it has been placed in local

* check if this is an export
if type(#0) = '-'
	* export
else
	* save to cimex file
fi


--------------------
  PreOpen.mac 
--------------------

* we can return 900 if we wish to terminate the open or save

--------------------
  PostOpen.mac
--------------------

* NOT CURRENTLY IMPLEMENTED

--------------------
  OpenSave.mac
--------------------

- OPEN
- SAVE

* this is called after Prexxxx and before Postxxxx
* we are only called if param(279) = 1
* we can return:
*  901 if we wish to terminate the open or save
*    1 filename returned from custom open macro (in &PATH)
*    2 do nothing, returning to regular open macro
*    3 filename with folder path also (in &PATH)
* This is intended to be a replacement for the standard open/close dialog boxes
* and is normally only overriden by Cimex for specific customers.