Mastering Computers, Inc.
Resource Disk Installation
Problem:
Mastering
Computers, Inc. (MCI), had been selling a collection of hand-picked, Windows 3.1x-based freeware and
shareware at its one-day Windows seminars. Attendees had been having extreme
difficulty in installing the collection and were calling in droves for
step-by-step instructions (lengthy "hand-holding"). Since the disk
only sold for $25 each, MCI was losing profits by having to provide this
service.
Solution: Being robbed of his own productivity, Chris Morton first
petitioned MCI management to license a professional Windows installation tool
such as InstallShield. His request being declined, Morton took it upon himself
to create the following custom installation program using WinBatch from Wilson
WindowWare, Inc.
; Installation program to copy a self-uncompressing file, ;\RESOURCE\RESOURCE.EXE from a floppy drive to a hard disk directory ;entitled "\RESOURCE". Once copied, program expands RESOURCE.EXE ;on hard disk creating recursive subdirectories in the process. ;Written by Chris Morton, Mastering Computers, Inc., 12/15/94 ; Last modified 1/27/95 |
;=========== Initialize Message Box and Floppy Variables ================
BoxOpen("Mastering Computers' Resource Disk 2.01 --
Setup"," Initializing... ")
IntControl(12,8,0,0,0)
WinPlace(10,8,800,248,"Mastering
Computers'")
flopdrv=DirGet()
;Compressed source file on floppy disk resourcefile=StrCat(flopdrv,"RESOURCE\RESOURCE.EXE")
targetdir="RESOURCE"
;Default target directory name
dskvol=""
floptext=StrCat(flopdrv,"RCREADME.TXT")
viewer=StrCat(DirWindows(0),"NOTEPAD.EXE")
Run(viewer,floptext)
IntControl(12,8,0,0,0)
WinTitle("Notepad -
RCREADME.TXT","Also Copying This File For
Reference")
WinPlace(1,256,1000,1000,"Also Copying This
File")
:ChooseVol
;Label reference for loopback
;=============== Test for Multiple Hard Disk Volumes
================
; If several hard disk volumes, user picks target volume (dskvol)
hdvols=DiskScan(2) ;Fetch list of
hard disk (hd) volumes
volcount=StrCharCount(hdvols) ;Count
characters in hd volume list
If volcount=="3" ;If count is 3, there's only a C: drive
onlyone="yes"
dskvol="C:"
Else
While dskvol==""
;There are add'l volumes; user picks one
onlyone="no"
dskvol=AskItemList("Set up Resource Disk on which disk
volume?",hdvols," ",@sorted,@single)
EndWhile
EndIf
;========== Error Test: Is Sufficient Disk Space Available?
============
freespace = DiskFree(dskvol)
If freespace < 5000000 ;Displays alert if not
free space on dskvol
If onlyone=="yes"
Display(5,"Please Free Up Some Hard Disk
Space"," The Resource Disk requires 5 MB of hard disk space.
")
WinClose("Also Copying This
File")
Exit
Else
needmore=StrCat("Not Enough Disk Space on
",dskvol)
Display(5,needmore,". Try another disk volume that has 5 MB of available space.
")
Goto ChooseVol
;Loop back up to volume choice routine
EndIf
EndIf
;Frees memory used by these variables
Drop(floptext,hdvols,volcount,onlyone,freespace,needmore)
;========== Test: Does a \RESOURCE Directory Already Exist?
===========
rootvol=StrCat(dskvol,"\") ;"rootvol"
= hard disk volume {drive:}\
DirChange(rootvol) ;change to rootvol
;solicit user for new directory name if {drive:\}RESOURCE
exists
If DirExist(targetdir)
existmsg=StrCat("There is already a \RESOURCE directory on
",dskvol)
Message(existmsg,"Try using a different directory
name.")
:Retry
targetdir=AskLine("New
Directory","Choose a different directory name. We
suggest:","RESDISK")
namelength=StrLen(targetdir)
If namelength > 8
Message("Oops!","You're limited to eight
characters.")
Goto Retry
EndIf
EndIf
;========= Create Directory and Copy RESOURCE.* to Disk
===============
DirMake(targetdir) ;create the directory
;"target" becomes {drive:}\RESOURCE or equivalent
target=StrCat(rootvol,targetdir)
DirChange(target) ;change to {drive}:\RESOURCE directory
;Frees memory used by these variables
Drop(dskvol,rootvol,existmsg,namelength)
copymsg1=StrCat("Copying
",resourcefile," to ",target,@crlf,@crlf,"Be patient, as this takes a
minute.")
BoxText(copymsg1)
;display progress message
rcreadme=StrCat(flopdrv,"RCREADME.TXT")
resourcepif=StrCat(flopdrv,"RESOURCE\RESOURCE.PIF")
targetdir=StrCat(target,"\*.*")
;Copy RESOURCE.EXE from floppy to {drive}:\RESOURCE
FileCopy(resourcefile,targetdir,@FALSE)
;Copy RESOURCE.PIF from floppy to {drive}:\RESOURCE
FileCopy(resourcepif,targetdir,@FALSE)
;Copy RCREADME file from floppy to {drive}:\RESOURCE
FileCopy(rcreadme,targetdir,@FALSE)
;Advance the display of RCREADME text file for user's
benefit
SendKeysTo("Also Copying This
File","^{END}")
;"resourcepifsys" = {drive}:\RESOURCE\RESOURCE.PIF
resourcepifsys=StrCat(target,"\RESOURCE.PIF")
;"resourcefilesys" = {drive}:\RESOURCE\RESOURCE.EXE
resourcefilesys=StrCat(target,"\RESOURCE.EXE")
expandmsg1=StrCat("Uncompressing
",resourcefilesys,@crlf,@crlf,"This can also take a minute to
complete.")
BoxText(expandmsg1) ;display progress message
;expand RESOURCE.EXE with recursive subdirectories
Run(resourcepifsys," ")
WinPlace(564,0,1000,500,"Expanding
RESOURCE")
WinWaitClose("Expanding
RESOURCE")
;pause before proceeding
BoxText("One moment while PK-ZIP is
uncompressed...")
Delay(2)
DirChange(target)
Run("NEWPKZIP\PK204G.EXE","")
;uncompress PK-ZIP package
unzipexe=StrCat(target,"\NEWPKZIP\PKUNZIP.EXE") ;initialize PKUNZIP.EXE
Drop(rcreadme,resourcefile,resourcepif,resourcepifsys)
Drop(resourcefilesys,zippackage)
;================= Test for Existence of COMMDLG.DLL
==================
;initialize COMMDLG.DLL to test for existence
dll1exist=StrCat(DirWindows(1),"COMMDLG.DLL")
;is a version already in the \SYSTEM subdirectory?
If FileExist(dll1exist)==@TRUE
;if so, is it newer than the version on the floppy?
If FileTimeCode(dll1exist) > 425263104
Goto COMMDLG_OK ;if newer, skip remainder of test
Else
GoSub COPYCOMMDLG ;if older, goto subroutine to copy floppy
vers.
Endif
Else
GoSub COPYCOMMDLG ;if file doesn't already exist, copy it
Endif
:COMMDLG_OK
Drop(dll1exist)
;================= Test for Existence of VBRUN200.DLL
==================
;initialize VBRUN200.DLL to test for existence
dll2exist=StrCat(DirWindows(1),"VBRUN200.DLL")
;is a version already in the \SYSTEM subdirectory?
If FileExist(dll2exist)==@FALSE
;if file doesn't already exist (see above), copy it
GoSub COPYVBRUN
Endif
Drop(dll2exist)
;============================= Cleanup
=================================
deletemsg=StrCat("Deleting
",expandfile,@crlf," and
",dlltarget,@crlf,@crlf,"The master files are stored on your floppy
disk.")
BoxText(deletemsg) ;display progress message
Delay(2)
FileDelete(resourcepifsys)
FileDelete(resourcefilesys)
If FileExist(sysunzip)==@TRUE
Then FileDelete(sysunzip)
BoxShut()
Message("SETUP Was
Successful"," Enjoy!")
WinWaitClose("SETUP Was")
WinClose("Also Copying This
File")
Exit
; ************ END OF SETUP PROGRAM! *************
;======================================================================
;============================= Subroutines ============================
;============== Copy COMMDLG.DLL Routine ===============
:COPYCOMMDLG
;dll1pif={A:}\RESOURCE\COMMDLG.PIF
dll1pif=StrCat(flopdrv,"RESOURCE\COMMDLG.PIF")
;dll1zip={A:}\RESOURCE\COMMDLG.ZIP
dll1zip=StrCat(flopdrv,"RESOURCE\COMMDLG.ZIP")
copymsg2=StrCat("Copying and uncompressing COMMDLG.DLL to
",DirWindows(1))
BoxText(copymsg2) ;display progress message to user
FileCopy(dll1pif,DirWindows(1),@FALSE) ;copy COMMDLG.PIF to \SYSTEM
FileCopy(dll1zip,DirWindows(1),@FALSE) ;copy COMMDLG.ZIP to \SYSTEM
;(var) sysunzip = \SYSTEM\PKUNZIP.EXE
sysunzip=StrCat(DirWindows(1),"PKUNZIP.EXE")
If FileExist(sysunzip)==@FALSE ;is PKUNZIP in \SYSTEM?
FileCopy(unzipexe,DirWindows(1),@FALSE) ;copy it over if it isn't
EndIf
;(var) dll1pifsys = \SYSTEM\COMMDLG.PIF
dll1pifsys=StrCat(DirWindows(1),"COMMDLG.PIF")
dll1zipsys=StrCat(DirWindows(1),"COMMDLG.ZIP")
Run(dll1pifsys) ;unzip COMMDLG.ZIP to yield COMMDLG.DLL
;WinPlace(564,0,1000,500,"Expanding COMMDLG.DLL")
WinWaitClose("Expanding COMMDLG.DLL")
FileDelete(dll1pifsys) ;delete \SYSTEM\COMMDLG.PIF
FileDelete(dll1zipsys) ;delete \SYSTEM\COMMDLG.ZIP
Drop(dll1pif,dll1zip,sysunzip,dll1pifsys,dll1zipsys)
Return
;============== Copy VBRUN200.DLL Routine ===============
:COPYVBRUN
;dll2pif={A:}\RESOURCE\VBRUN200.PIF
dll2pif=StrCat(flopdrv,"RESOURCE\VBRUN200.PIF")
;dll2zip={A:}\RESOURCE\VBRUN200.ZIP
dll2zip=StrCat(flopdrv,"RESOURCE\VBRUN200.ZIP")
copymsg3=StrCat("Copying and uncompressing VBRUN200.DLL to
",DirWindows(1))
BoxText(copymsg3) ;display progress message to user
FileCopy(dll2pif,DirWindows(1),@FALSE) ;copy VBRUN200.PIF to \SYSTEM
FileCopy(dll2zip,DirWindows(1),@FALSE) ;copy VBRUN200.ZIP to \SYSTEM
;(var) sysunzip = \SYSTEM\PKUNZIP.EXE
sysunzip=StrCat(DirWindows(1),"PKUNZIP.EXE")
If FileExist(sysunzip)==@FALSE ;is PKUNZIP in \SYSTEM?
FileCopy(unzipexe,DirWindows(1),@FALSE) ;copy it over if it isn't
EndIf
;(var) dll2pifsys = \SYSTEM\VBRUN200.PIF
dll2pifsys=StrCat(DirWindows(1),"VBRUN200.PIF")
dll2zipsys=StrCat(DirWindows(1),"VBRUN200.ZIP")
Run(dll2pifsys) ;unzip VBRUN200.ZIP to yield VBRUN200.DLL
;WinPlace(564,0,1000,500,"Expanding VBRUN200.DLL")
WinWaitClose("Expanding
VBRUN200.DLL")
FileDelete(dll2pifsys)
;delete \SYSTEM\VBRUN200.PIF |
Drop(dll2pif,dll2zip,sysunzip,dll2pifsys,dll2zipsys)
Return