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]: Feature[Next]: /Feature
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->Feature?

The "Feature?" Command

This command has two main uses, it can be used to find out if you are nested within a "Feature" block or it can obtain the name of the "current" feature.

The macro takes these parameters:

EXAMPLE 1

You are writing a macro and want to be able to allow a "FEATURE" parameter to default to the "current" feature (if no "current" then you want to put out your own error message):

#( ''
    #define UsesFeature
    #define+ @@SharedFeature {$Feature=^^}      ;;Get "feature" parameter passed by invoker
    #if ['<$@@SharedFeature>' = '']
        ;--- No feature passed, are we nested within one --------------------
        #define+ @@SharedFeature <$Feature? QUERY="Y">
        #if ['<$@@SharedFeature>' = '']
            #error ^Feature information not supplied and no current feature...^
        #endif
    #endif

    ;--- Do stuff -----------------------------------------------------------
    ;...
    #info ^FEATURE=<$@@SharedFeature>^
#)

EXAMPLE 2

The following script uses this macro to obtain the current feature, if it were not used within a feature "block" then an error would result:

;----------------------------------------------------------------------------
;    MODULE NAME:   IceAddToOrca.MM
;
;        $Author:   USER "Dennis"  $
;      $Revision:   1.2  $
;          $Date:   22 Jul 2006 10:07:42  $
;       $Logfile:   C:/DBAREIS/Projects.PVCS/Win32/MakeMsi/IceAddToOrca.MM.pvcs  $
;      COPYRIGHT:   (C)opyright Dennis Bareis, Australia, 2003
;                   All rights reserved.
;
; DESCRIPTION
; ~~~~~~~~~~~
; Creates an MSI which updates ORCA's menu to include a new CUB file.
;----------------------------------------------------------------------------


;----------------------------------------------------------------------------
;--- Define validation Suite and ensure it exists ---------------------------
;----------------------------------------------------------------------------
#define CUB_FILE  out\ICE.mm\MSI\Validations Plus Custom (by Dennis Bareis).CUB
#if FileQueryExists("<$CUB_FILE>") = ''
    #error ^The CUB file "<$CUB_FILE>"{NL}doesn't exist!{NL}{NL}Have you built it using "ICE.MM" yet?^
#endif


;----------------------------------------------------------------------------
;--- Load MAKEMSI (via wrapper) ---------------------------------------------
;----------------------------------------------------------------------------
#define? COMPANY_MSINAME_SUFFIX.D       ;;"DENNIS.MMH" specified "(TEST)"
#include "DENNIS.MMH"


;----------------------------------------------------------------------------
;--- Create INSTALLDIR ------------------------------------------------------
;----------------------------------------------------------------------------
<$DirectoryTree Key="INSTALLDIR" Dir="c:\program files\<$ProdInfo.ProductName>" CHANGE="\" PrimaryFolder="Y">


;----------------------------------------------------------------------------
;--- Create a qualified component holding the file --------------------------
;----------------------------------------------------------------------------
<$Component "DBVALID.CUB" Create="Y" Directory_="INSTALLDIR">
   ;--- Add the CUB file to this component (make Keypath) -------------------
   <$Files "<$CUB_FILE>" KeyFile="*">

   ;--- Qualify this component ----------------------------------------------
   <$Table "PublishComponent">
   #(
       <$Row
              Feature_="<$Feature?>"                              ;;"Current" feature's name.
            Component_="<$Component?>"                            ;;"Current" component's name. I THINK the keypath is used by ORCA to know which ICE DB to run...
           ComponentId="{DC441E1D-3ECB-4DCF-B0A5-791F9C0F4F5B}"   ;;GUID obtained by examining the ORCA MSI
             Qualifier="<$ProdInfo.ProductName><$ProductVersion>" ;;Any (I assume unique) identifier will do...
               AppData=^Validation suite created by "ICE.MM"^     ;;Text ORCA will display in it's menu
       >
   #)
   <$/Table>
<$/Component>


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]: Feature[Next]: /Feature


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.