|Options for Commands|
A lot of the MAKEMSI commands, features as well as tips can be configured through "options". These are not always documented.
Make sure you have read the "Introduction to PPWIZARD" section and possibly have a look at the PPWIZARD documentation (MAKEMSI installed it). Most of the "magic" you can do with MAKEMSI will be documented in the PPWIZARD manual.
Some commands allow the specification of default switches/options for the command, if you duplicate one of these then the default "PPWIZARD" behaviour is to allow this if the value is the same. MAKEMSI should add defaults to the start of the parameter strings so user ones follow, that being the case you may want to set the value to "USELAST", in the following value "2" will be set for the "REMOVE" parameter:
#option DuplicateParms="USELAST" <$SomeMacro Key="INSTALLDIR" REMOVE="1" CHANGE="\" MAKE="Y" REMOVE="2">
Generally a command such as "Registry" has its supporting code in a file called "Registry.mmh" or similar. It can be useful to look at the ".MMH" header files for "#define?" commands which is how most configuration is performed, the following is a fictional example:
#define? REGISTRY_SOMETHING 10 ;;A possible comment about the option
The "#define?" command is used to define a default value such as "REGISTRY_SOMETHING". The option will only have a value of 10 if you had not previously given it a different value! To give it your own value you would normally use a command such as the following before including the MAKEMSI headers:
#define REGISTRY_SOMETHING 5 ;;My value!
Note the use of the "#define" command here, you could have used "#define?", however if you don't plan on allowing yourself to override your own default value then do not use "#define?", you will then get appropriate error messages if you have made a mistake.
Sometimes you will wish to override an option in a particular script of yours so you would add the commands at the start of your script, however frequently you wish to override the options for every script you create, in this case the appropriate location is your own header file (similar to my "DENNIS.MMH" file).
There will be times where you wish to override a value during the execution of your script (not all options can be controlled this way), in this case you might do something more like:
... #define+ REGISTRY_SOMETHING 5 ;;New value ;--- Do something with this value as default --- ... #define+ REGISTRY_SOMETHING 10 ;;The value you want for what follows
Notice that in the above "#define+" was required to override existing values without getting warning messages. As with the "#define?" command, do not use "#define+" where it is not required as this will reduce the error messages you will get if you do something "wrong".
|Process Mode Dependent|
This example conditionally sets up the default value for the VbsCa command's "PAUSE" parameter so that by default debug pauses will be generated in development mode but not for production.
;--- What should be the default "PAUSE" parameter value? --- #define? DEFAULT_DEBUG_PAUSE.D Y ;;Default to PAUSE=Y in dev #define? DEFAULT_DEBUG_PAUSE.P N ;;Default to PAUSE=N in prod ;--- Load MAKEMSI (via wrapper) --- #define? SUNDRY_CA_PAUSE <$DEFAULT_DEBUG_PAUSE.[MMMODE]> #include "DEPT.MMH" ...
In the above I used "#define?" for all 3 definitions allowing the values to be overriden at both levels if required, the user has two main choices:
|Saving and Restoring State|
You may wish to make a temporary change to the value of a macro in a small fragment of code without wanting to worry about what the downstream impact of this might be to any code that may follow.
The "MacroCfg" command is the easiest way to save and restore a macro's state.