// Mesa 2.3 installation file
@var            ABCDEFG: "230" 7

// check for update
@option         A:      K: "exists:%1\mesa2.exe"
@option         K:      L: "ask:Update the installed copy of Mesa 2?"
@errorexit      (K!L):  "Install not attempted."

// check for running copy
@option         A:      K: "busy:%1\mesa2.exe"
@option         K:      L: "ask:The copy of Mesa 2 in the installation directory appears to be running.  Try to install anyway?"
@errorexit      (K!L):  "Install not attempted."

// turn on extended messages if necessary
@poo            H:      OE

// check for prerelease existance
@option         A:      P: "object:<MESA2PR>"
@message:       (AP):   "Mesa 2 PreRelease version appears installed on system."
@info:          (AP):   %0\prreadme.txt

// force object recreation if prerelease exists
@option         (AP):   N: "1"

// see if user wants to uninstall the prerelease or continue
@getini         (AP):   * MesaPR INSTALLATIONPATH 9
@option         (AP):   !K: "null:%9"
@mbox           (AP!K): "Automatic uninstall of the PreRelease is not possible."
@option         (APK):  K: "ask:Do you want to uninstall the PreRelease from %9?"
@var            (APK):  %1 8
@var            (APK):  %9 1
@script         (APK):  %0\pruninst.lst
@var            (APK):  %8 1
@mbox           (APK):  "Mesa 2 PreRelease uninstalled.  Please reboot after installation completes."
@option         (AP!K): K: "ask:Do you want to continue?"
@errorexit      (AP!K): "Install not attempted."

// check version for palette support
@option         AEF:    M: "version >= 230"
@messagebox:    (E!M)(F!M): "The Mesa 2 Palette features require Warp 3 or higher. They will not be installed."

// setup program result codes
@prm            ABCD:   1       "Portions of the zip file were not processed."
@prm            ABCD:   2       "The zip file is damaged."
@prm            ABCD:   3       "The zip file is badly damaged."
@prm            ABCD:   9       "The zip file was not found."
@prm            ABCD:   50      "A file cannot be copied (file is in use or there is not enough disk space)."
@prm            ABCD:   51      "The end of the zip file was encountered prematurely."
@prm            ABCD:   81      "The zip file was not processed."

// create directory if necessary
@directory      ABCD:   %1
@cd             ABCD:   %1

// make sure the directories are there
@directory      ABCD:   %1\TEMPLATE
@directory      ABCD:   %1\EXAMPLES
@directory      ABCD:   %1\DEFAULTS

// copy standard files
@copy           ABCD:   %0\README.TXT %1\README.TXT
@copy           ABCD:   %0\LICENSE.TXT %1\LICENSE.TXT

// copy uninstall files
@copy           A:      %0\install.exe  %1\uinstall.exe
@copy           A:      %0\uinstall.lst %1\uinstall.lst
@copy           A:      %0\uinstall.1   %1\uinstall.1
@copy           A:      %0\uinstall.dat %1\uinstall.cmd

// copy unzip
@copy           ABCD:   %0\UNZIP.EXE %1\UNZIP.EXE

// delete the current executable (just in case)
@del            A:      %1\mesa2.exe

// copy program files
@pgm            A:      3 %1\unzip -o %0\program1.zip

// copy default files
@pgm            A:      3 %1\unzip -o %0\defaults.zip

// copy doc files (remove any old inf files first)
@del            B:      %1\mesa2doc.inf
@del            B:      %1\mesa2.inf
@pgm            AB:     3 %1\unzip -o %0\docs.zip

// copy default templates
@pgm            D:      3 %1\unzip -o %0\template.zip

// flip disks
@disk           AC:     %0\disk.2

// copy program files
@pgm            A:      3 %1\unzip -o %0\program2.zip

// copy example files
@pgm            C:      3 %1\unzip -o %0\examples.zip

// create the INF file if necesary
@option         B:      O: "exists:%1\mesa2.inf"
@copy           (B!O):  %1\mesa2.hlp %1\mesa2.inf
@brand          (B!O):  INF %1\mesa2.inf

// replace the wppalet.dll
@mcopy          (AM):   %1\wppalets.dl_ %1\wppalets.dll %1\wppalets.bkp
@del            (AM):   %1\wppalets.dl_
@del            (AM):   %1\wppalets.bkp
@option         (AM):   L: "exists:%1\wppalets.hl_"
@lcopy          (ALM):  %1\wppalets.hl_ %1\wppalets.hlp
@del            (ALM):  %1\wppalets.hl_

// replace the mesaprt.dll
@mcopy          A:      %1\mesaprt.dl_ %1\mesaprt.dll %1\mesaprt.bkp
@del            A:      %1\mesaprt.dl_
@del            A:      %1\mesaprt.bkp

// unzip isn't needed anymore, delete it
@del            ABCD:   %1\UNZIP.EXE

// save installation path and version
@setini         A:      * Mesa2 INSTALLATIONPATH %1
@setini         A:      * Mesa2 VERSION %7

// register Workplace Shell classes
// the new palettes
@class          (EM):   WPLineWidthPalette %1\WPPALETS.dll
@class          (EM):   WPLineStylePalette %1\WPPALETS.dll
@class          (EM):   WPMarkerPalette    %1\WPPALETS.dll
@class          (EM):   WPPatternPalette   %1\WPPALETS.dll

// the file classes
@class          E:      WPMesaFile         %1\MESAPRT.dll
@class          E:      WPMesaTemplateFile %1\MESAPRT.dll
@class          E:      WPMesaBackupFile   %1\MESAPRT.dll

// create objects
// note: use different creation order Warp 4 because of different placement in folder
@var:           F:      <M2_FOLDER> 5
@var:           F:      UPDATE 6
@var:           (FN):   REPL 6

@wps:           F:
WPFolder
"Mesa 2"
OBJECTID=%5;BACKGROUND=%1\Mesa2Bkg.BMP,T,1,I;
<WP_DESKTOP>
%6

// check version for object order URL support
@option         F:      O: "version >= 240"

// warp 4 order

@wps:           (FO):
WPProgram
"Mesa 2|Uninstall"
"EXENAME=CMD.EXE;PARAMETERS=/C UINSTALL.CMD;STARTUPDIR=%1;MINIMIZED=YES;OBJECTID=<M2_UINSTALL>;"
%5
%6

@WPS            (FO):
WPShadow
"Font|Palette"
ShadowID=<WP_FNTPAL>;OBJECTID=<M2_WP_FNTPAL>;
%5
%6

@WPS            (FO):
WPShadow
"Color|Palette"
ShadowID=<WP_HIRESCLRPAL>;OBJECTID=<M2_WP_HIRESCLRPAL>;
%5
%6

@wps:           (FOM):
WPMarkerPalette
"Marker|Palette"
OBJECTID=<WP_MARKPAL>;
%5
%6

@wps:           (FOM):
WPLineStylePalette
"Line Style|Palette"
OBJECTID=<WP_LINEPAL>;
%5
%6

@wps:           (FOM):
WPLineWidthPalette
"Line Width|Palette"
OBJECTID=<WP_LINEWPAL>;
%5
%6

@wps:           (FOM):
WPPatternPalette
"Pattern|Palette"
OBJECTID=<WP_PATPAL>;
%5
%6

@WPS            (FO):
WPShadow
"Examples"
ShadowID=%1\EXAMPLES;OBJECTID=<M2_EXAMPLES>;
%5
%6

@WPS            (FO):
WPShadow
"Templates"
ShadowID=%1\TEMPLATE;OBJECTID=<M2_TEMPLATES>;
%5
%6

// warp 4 only
@wps:           (FO):
WPUrl
"Mesa 2|Home Page"
URL=http://www.sundialsystems.com/mesahome;OBJECTID=<M2_URL>;
%5
%6

@wps:           (FBO):
WPProgram
"Mesa 2|Documentation"
EXENAME=VIEW.EXE;STARTUPDIR=%1;PARAMETERS=MESA2.INF;OBJECTID=<M2_DOC>;
%5
%6

@wps:           (FO):
WPProgram
"Mesa 2"
"EXENAME=%1//Mesa2.EXE;STARTUPDIR=%1;ASSOCFILTER=*.M2,*.M2T,*.M2B;ASSOCTYPE=Mesa Workbook File,Mesa Backup File,Mesa Template File;OBJECTID=<M2_PROGRAM>;"
%5
%6

@wps:           (FO):
WPProgram
"License|Agreement"
EXENAME=E.EXE;STARTUPDIR=%1;PARAMETERS=LICENSE.TXT;OBJECTID=<M2_LICENSE>;
%5
%6

@wps:           (FO):
WPProgram
"Read Me"
EXENAME=E.EXE;STARTUPDIR=%1;PARAMETERS=README.TXT;OBJECTID=<M2_README>;
%5
%6

// warp 3 and lower order                
@wps:           (F!O):
WPProgram
"Read Me"
EXENAME=E.EXE;STARTUPDIR=%1;PARAMETERS=README.TXT;OBJECTID=<M2_README>;
%5
%6

@wps:           (F!O):
WPProgram
"License|Agreement"
EXENAME=E.EXE;STARTUPDIR=%1;PARAMETERS=LICENSE.TXT;OBJECTID=<M2_LICENSE>;
%5
%6

@wps:           (F!O):
WPProgram
"Mesa 2"
"EXENAME=%1//Mesa2.EXE;STARTUPDIR=%1;ASSOCFILTER=*.M2,*.M2T,*.M2B;ASSOCTYPE=Mesa Workbook File,Mesa Backup File,Mesa Template File;OBJECTID=<M2_PROGRAM>;"
%5
%6

@wps:           (FB!O):
WPProgram
"Mesa 2|Documentation"
EXENAME=VIEW.EXE;STARTUPDIR=%1;PARAMETERS=MESA2.INF;OBJECTID=<M2_DOC>;
%5
%6

@WPS            (F!O):
WPShadow
"Templates"
ShadowID=%1\TEMPLATE;OBJECTID=<M2_TEMPLATES>;
%5
%6

@WPS            (F!O):
WPShadow
"Examples"
ShadowID=%1\EXAMPLES;OBJECTID=<M2_EXAMPLES>;
%5
%6

@wps:           (F!OM):
WPPatternPalette
"Pattern|Palette"
OBJECTID=<WP_PATPAL>;
%5
%6

@wps:           (F!OM):
WPLineWidthPalette
"Line Width|Palette"
OBJECTID=<WP_LINEWPAL>;
%5
%6

@wps:           (F!OM):
WPLineStylePalette
"Line Style|Palette"
OBJECTID=<WP_LINEPAL>;
%5
%6

@wps:           (F!OM):
WPMarkerPalette
"Marker|Palette"
OBJECTID=<WP_MARKPAL>;
%5
%6

@WPS            (F!O):
WPShadow
"Color|Palette"
ShadowID=<WP_HIRESCLRPAL>;OBJECTID=<M2_WP_HIRESCLRPAL>;
%5
%6

@WPS            (F!O!M):
WPShadow
"Color|Palette"
ShadowID=<WP_CLRPAL>;OBJECTID=<M2_WP_CLRPAL>;
%5
%6

@WPS            (F!O):
WPShadow
"Font|Palette"
ShadowID=<WP_FNTPAL>;OBJECTID=<M2_WP_FNTPAL>;
%5
%6

@wps:           (F!O):
WPProgram
"Mesa 2|Uninstall"
"EXENAME=CMD.EXE;PARAMETERS=/C UINSTALL.CMD;STARTUPDIR=%1;MINIMIZED=YES;OBJECTID=<M2_UINSTALL>;"
%5
%6

// add the templates as INI entries
@SETINI         D:      %1\Mesa2.INI  Mesa2 "lastTemplate 1" %1\TEMPLATE\Invoice.M2T
@SETINI         D:      %1\Mesa2.INI  Mesa2 "lastTemplate 2" %1\TEMPLATE\Expense.M2T

// set the Warp 4 Selection Manager style
@option         A:      O: "version >= 240"
@SETINI         (AO):   %1\Mesa2.INI  Mesa2 "WARP4SELECTIONMANAGER" "1"

// update CONFIG.SYS
@config         G:      %2\CONFIG.SYS %2\CONFIG.BAK LIBPATH .; START
@config         G:      %2\CONFIG.SYS %2\CONFIG.BAK "SET HELP" .; START

// remove obsolete 2.1 and 2.0 files (from same directory)
@option         I:      K: "exists:%1\DLL\mesacore.dll"
@message        (IK):   "Removing obsolete files from earlier versions..."
@delete         (IK):   "%1\DLL\mesacore.dll"
@delete         (IK):   "%1\DLL\mesafeed.dll"
@option         I:      J: "exists:%1\DLL\mesalic.dll"
@delete         (IJ):   "%1\DLL\mesalic.dll"
@rd             (IK):   "%1\DLL"
@option         I:      J: "exists:%1\mesadlc.dll"
@message        (IJ!K): "Removing obsolete files from earlier versions..."
@delete         (IJ):   "%1\mesadlc.dll"
@option         I:      J: "exists:%1\epfinsts.exe"
@delete         (IJ):
%1\epfiEXTS.dll
%1\EpfiHPLB.HLP
%1\epfiicis.ico
%1\epfimsg.msg
%1\epfipii.dll
%1\epfiprcs.exe
%1\EPFISINC.PKG
%1\epfiupk2.exe
%1\epfinsts.exe
@option         I:      J: "exists:%1\mesa.dsc"
@message        (IJ!K): "Removing obsolete files from earlier versions..."
@delete         (IJ):
%1\mesa.dsc
%1\mesa.icf
%1\mesa.pkg
%1\mesafaq.txt
@option         I:      J: "exists:%1\m2model.ico"
@delete         (IJ):
%1\m2model.ico
%1\m2bmodel.ico

// remove obsolete 2.1 and 2.0 objects
@option         (FIK):   J: "object:<MESA2>"
@option         (FIK):   J: "ask:Do you want to remove the old Mesa for OS/2 folder?"

@message        (FIK):   "Removing obsolete objects from earlier versions..."

@xwps:          (FIK):
<M2FAQ>
<M2EXE>
<MESA2NSTS>

@xwps:          (FIKJ):
<MESA2>

