MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Debug Macro - Cause Rollback (or just failure)[Next]: Device Driver Installation
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Debug Macro - Wait While Displaying Message

Debug Macro - Wait While Displaying Message

Sometimes you just want to check what is going on during the install. The macro described here allows you to sequence pauses and display information. This could also give you time to examine the current machine state (were all files installed correctly etc) before going on to the next step.

The macro described below will be very useful for debugging:

;----------------------------------------------------------------------------
;--- Macro for inserting Debug Pauses (ver 06.113) --------------------------
;----------------------------------------------------------------------------
#( '<?NewLine>'
    #define DebugWait

    ;--- Validate parameters and keep count ---------------------------------
    {$!:TEXT,SEQ,SEQTABLE,TYPE,CONDITION}
    #RexxVar RxDebugWaitCnt + 1     ;;Inc Count (need diff binaries as text may/will differ)

    ;--- Don't do anything in production mode! ------------------------------
    #if ['<$MmMode>' = '<$MMMODE_PRODUCTION>']
        ;--- In production mode warn first time -----------------------------
        #if [RxDebugWaitCnt = 1]
            #info ^DebugWait not inserted in production mode!^
        #endif
    #elseif
        ;--- Not Production mode --------------------------------------------
        <$VbsCa Binary="DebugWait_<??RxDebugWaitCnt>.vbs">
           <$VbsCaEntry "MessageBox">
               ;--- Will display whether or not in "silent" mode --------------------
               MsgBox "{$Text=^Waiting...^}" & vbCRLF & vbCRLF & "Defined at <??RxMmLocation>", vbInformation, "DebugWait: <$ProdInfo.ProductName> v<$ProductVersion>"
           <$/VbsCaEntry>
        <$/VbsCa>
        <$VbsCaSetup Binary="DebugWait_<??RxDebugWaitCnt>.vbs" Entry="MessageBox" Seq="{$Seq}" CONDITION=^{$Condition=~<$CONDITION_INSTALL_ONLY>~}^ Type="{$Type=^Deferred^}" SeqTable="{$SeqTable=^InstallExecuteSequence^}">
    #endif
#)
#RexxVar RxDebugWaitCnt = 0         ;;Init count

The follow shows how the macro could be used:

<$DebugWait Seq="<-CostInitialize" SeqTable="InstallUISequence InstallExecuteSequence" Type="Immediate">
<$DebugWait Seq="DuplicateFiles-" Text="Just after files installed! Check them now">

In the above example you will note that the first message box is displayed twice (one per sequence table), you could use a type of "Immediate FirstSequence" to have it only display once (if you're wondering why you wouldn't just change the "SeqTable" parameter then remember "silent" installations).

This is another example which defines a macro to test conditions and then uses it to report if a condition is TRUE (won't run if not, either way a verbose log will show:

#(
    #define TestCondition
    <$DebugWait Seq=^{$Seq="DuplicateFiles-"}^ Condition=^{$COND}^ Text=^TRUE CONDITION: {$COND} | Sequenced at: {$Seq} | {$Text=""}^>
#)

<$TestCondition COND=^CHK1 = 1 and CHK2 = 1^>
<$TestCondition COND=^CHK1 = 1 AND CHK2 = 1^>       ;;Test if case of "and" statement matters (it doesn't)

Note that conditions may evaluate differently depending on where they are schedules as well has how (immediate versus deferred).

For more information about scheduling options see the "VbsCaSetup" command.


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Debug Macro - Cause Rollback (or just failure)[Next]: Device Driver Installation


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.