home *** CD-ROM | disk | FTP | other *** search
/ A Multimedia Storybook - Don Quixote / QUIXOTE.BIN / setup.inf < prev    next >
Text File  |  1992-09-12  |  47KB  |  1,217 lines

  1.  
  2.     ;;*************Begin Title Specific Section***************************
  3.  
  4.     ;;
  5.     ;; SetVariable (Variable, String)
  6.     ;; ------------------------------
  7.     ;; This command sets the variable named 'Variable' to the string
  8.     ;; 'String'.
  9.     ;;
  10.  
  11.     ;;     Change this variable to be the name of the title.
  12.     ;;
  13. SetVariable (TitleName, "Ebook's Don Quixote")    ; Name of the title
  14.  
  15.     ;;    Change this variable to be the basename of the title's MVB
  16.     ;;    file (i.e. the name of the MVB file without the .MVB 
  17.     ;;    extension).
  18.     ;;
  19. SetVariable (TitleMVB, "QUIXOTE")        ; Basename of the MVB file
  20.  
  21.     ;;    Change this variable to be the subdirectory of the title
  22.     ;;    on the CD-ROM (i.e. where the MVB file is located).  This 
  23.     ;;    subdirectory will be in the Viewer directory on the CD-ROM,
  24.     ;;    where VIEWER.EXE and SETUP.EXE are located.  Do not specify
  25.     ;;    the complete path for this subdirectory.
  26.     ;;
  27. SetVariable (TitleSrcDir, "\QUIXOTE\")    ; Source subdirectory of the title
  28.  
  29.     ;;***************End Title Specific Section***************************
  30.  
  31.     ;;
  32.     ;; GetCurPath (Variable)
  33.     ;; ---------------------
  34.     ;; This command sets the variable 'Variable' to the current path.
  35.     ;; This is the full path of the directory in which SETUP.EXE was 
  36.     ;; started.  A directory name ends in a backslash.
  37.     ;;
  38.  
  39. GetCurPath (ViewerSrcDir)        ; Source directory of the Viewer
  40. SetVariable (ViewerSize, 1 000 000)    ; Size of the Viewer files that will
  41.                     ;  be copied over (measured in bytes)
  42. SetVariable (ViewerDestDir, "C:\VIEWER\")    ; Destination directory for 
  43.                         ;  the Viewer.  Set default
  44.                         ;  here.
  45.  
  46.     ;;
  47.     ;; WindowTitle (Title)
  48.     ;; -------------------
  49.     ;; This command sets the title bar of all subsequent dialog windows to
  50.     ;; the string 'Title'.  The title string must be limited to 127 
  51.     ;; characters.  The title bar can be changed before the first dialog
  52.     ;; window is shown or at any later time using this command.  By 
  53.     ;; default, the title for all dialog windows is "Setup".
  54.     ;;
  55.  
  56. ; Set the title of all dialog windows.
  57. ;
  58. WindowTitle (<TitleName> " Setup")
  59.  
  60.  
  61. ; Set the instruction text used in the initial instructions window.
  62. ; Add Help instructions if the file SETUP.HLP exists.
  63. ;
  64. SetVariable (InitialInstructions, 
  65.     "Click on {\b OK} or press {\b Enter} to continue.  "
  66.     "To abort the setup, click on the {\b Exit} button at the "
  67.     "bottom right corner of the screen, or press {\b F3}.  ")
  68.  
  69.     ;;
  70.     ;; IfFileExistsGoto (FileName, Label)
  71.     ;; ----------------------------------
  72.     ;; This command causes execution to jump to label 'Label' if the
  73.     ;; specified file exists.  This command can be used while the copy
  74.     ;; progress bar is up, but if you do so then you should not check if a
  75.     ;; file exists if that file has been created between the 
  76.     ;; 'OpenCopyProgress' and the 'IfFileExistsGoto'.  The reason for this
  77.     ;; is that 'OpenCopyProgress' will first step through all the copy and
  78.     ;; branching commands until the 'CloseCopyProgress' command without
  79.     ;; actually copying any files.  This is done in order to find the
  80.     ;; range for the copy progress bar.  The 'IfFileExistsGoto' command
  81.     ;; is typically used to see if you are reinstalling files.
  82.     ;;
  83.  
  84. IfFileExistsGoto ("SETUP.HLP", AddHelpInstructions)
  85.  
  86.     ;;
  87.     ;; Goto (Label)
  88.     ;; ------------
  89.     ;; This command will unconditionally cause execution to branch to the
  90.     ;; label 'Label'.
  91.     ;;
  92.  
  93.     Goto (DisplayInitialMessage)
  94. AddHelpInstructions:
  95.     SetVariable (InitialInstructions, 
  96.         <InitialInstructions> "You can always obtain help by "
  97.         "clicking on the {\b Help} button or pressing {\b F1}.  ")
  98.  
  99.     ;;
  100.     ;; DisplayMessage (Text, Instructions)
  101.     ;; -----------------------------------
  102.     ;; This command displays the message 'Text' in a dialog box and the
  103.     ;; instruction text 'Instructions' in the instructions window.  
  104.     ;; A single "OK" default push button at the bottom center of the 
  105.     ;; dialog is used to resume.
  106.     ;;
  107.  
  108. ; Display the initial message.
  109. ;
  110. DisplayInitialMessage:
  111. DisplayMessage (
  112.     "
  113.         
  114.     This Setup program will install:
  115.     
  116.         " <TitleName> "
  117.     
  118.         and the Multimedia Viewer.
  119.         
  120.     
  121.     You will be prompted for the location for the
  122.     Multimedia Viewer. This will require about 1
  123.     Megabyte of disk space.",
  124.     <InitialInstructions>)
  125.  
  126.     ;;
  127.     ;; GetFromWinIni (Variable, Section, Name, Default)
  128.     ;; ------------------------------------------------
  129.     ;; This command reads the WIN.INI file entry 'Name' under the section
  130.     ;; 'Section' and sets the variable 'Variable' to the result.  If the
  131.     ;; specified section or entry were not found, then the specified 
  132.     ;; variable is set to the string 'Default'.
  133.     ;;
  134.  
  135. ; Determine if the Viewer has been installed before.
  136. ; If the WIN.INI file contains information on where the Viewer directory
  137. ; is located, then make that the default path to install the Viewer.
  138. ;
  139. GetFromWinIni (ViewerDestDirTemp, 
  140.     "Multimedia Viewer", "ViewerPath", "Undefined")
  141.  
  142.     ;;
  143.     ;; IfEqualGoto (String1, String2, Label)
  144.     ;; -------------------------------------
  145.     ;; This command will do a case insensitive compare on the strings
  146.     ;; 'String1' and 'String2' and branch to label 'Label' if they match.
  147.     ;;
  148.  
  149. IfEqualGoto (<ViewerDestDirTemp>, "Undefined", PromptViewerDestDir)
  150. SetVariable (ViewerDestDir, <ViewerDestDirTemp>)
  151.  
  152.  
  153. AskAgain:
  154.  
  155.     ;;
  156.     ;; PromptPath (Variable, Default, Message, ValidInstructions,
  157.     ;;        InvalidInstructions)
  158.     ;; ----------------------------------------------------------
  159.     ;; This command causes a dialog box to appear that prompts the user 
  160.     ;; for a path.  The path is a directory that the setup script can use
  161.     ;; to copy into, make, etc.  The message 'Message' is shown at the top
  162.     ;; of the dialog, and the default path is 'Default'.   When PromptPath
  163.     ;; is invoked, Setup checks that the default specified in the INF file
  164.     ;; is a valid path on the user's machine. 
  165.     ;;
  166.     ;; The PromptPath dialog can be in two states.  Whenever the edit box
  167.     ;; contains a valid path, the OK button is available and the 
  168.     ;; 'ValidInstructions' text is displayed in the instruction window.
  169.     ;; Whenever the edit box contains an invalid path, the OK button is
  170.     ;; grayed out and the 'InvalidInstructions' text is displayed in the
  171.     ;; instruction window.
  172.     ;;
  173.     ;; All characters typed in the path edit box appear as upper case no
  174.     ;; matter what the keyboard shift state is in.  When the OK button is
  175.     ;; enabled, the user can click on the OK button or press Enter, upon
  176.     ;; which the path is placed in the variable 'Variable'.  Before
  177.     ;; returning the path however, PromptPath will translate all forward
  178.     ;; slashes to back slashes and ensure that the path ends in a
  179.     ;; back slash.
  180.     ;;
  181.  
  182. ; Ask for where the Multimedia Viewer should be installed.
  183. ;
  184. PromptViewerDestDir:
  185. PromptPath (ViewerDestDir, <ViewerDestDir>,
  186.     "Where should Setup install the Multimedia Viewer?",
  187.     "Modify the default path if necessary, and then click on {\b OK} or "
  188.     "press {\b Enter} to continue.  ",
  189.     "The path is currently not valid.  You must specify a drive "
  190.     "letter, a colon, and a directory from the root of the drive.  ")
  191.  
  192.     ;;
  193.     ;; GetWinPath (Variable)
  194.     ;; ---------------------
  195.     ;; This command sets the variable 'Variable' to the path of the
  196.     ;; Windows directory.  The directory name ends in a backslash.
  197.     ;;
  198.     ;;
  199.  
  200. ; Don't allow Viewer to be installed in the Windows directory
  201. ;
  202. GetWinSystemPath (SystemPath)
  203. GetWinPath (WinPath)
  204. IfNotEqualGoto (<ViewerDestDir>, <WinPath>, CheckSpace)
  205. DisplayMessage (
  206.     "You cannot install the Viewer into the Windows directory.  "
  207.     "Please enter another directory.",
  208.     "Click on {\b OK} or press {\b Enter} to enter another directory "
  209.     "for Viewer.")
  210. Goto (PromptViewerDestDir)
  211.  
  212.     ;;
  213.     ;; GetSpaceAvailable (Variable, Path)
  214.     ;; ----------------------------------
  215.     ;; This command finds the number of bytes available on the disk of 
  216.     ;; the full path 'Path', and sets the variable 'Variable' to the 
  217.     ;; string representation of this value.  The value 0 is returned if
  218.     ;; the specified volume does not exist or cannot be read.
  219.     ;;
  220.  
  221. ; Check if there is enough space to install the Viewer.
  222. ;
  223. CheckSpace:
  224. GetSpaceAvailable (SpaceAvailable, <ViewerDestDir>)
  225.  
  226.     ;;
  227.     ;; IfLowerGoto (Number1, Number2, Label)
  228.     ;; -------------------------------------
  229.     ;; This command will compare 'Number1' and 'Number2', which are 
  230.     ;; strings interpreted as integers.  If 'Number1' is lower than 
  231.     ;; 'Number2' then execution branches to 'Label'.
  232.     ;;
  233.  
  234. IfLowerGoto (<ViewerSize>, <SpaceAvailable>, ViewerDestDirOK)
  235.  
  236.     ;;
  237.     ;; AskYesNo (Variable, Default, Question, Instructions)
  238.     ;; ----------------------------------------------------
  239.     ;; This command displays the string 'Question' in a dialog box and the
  240.     ;; instruction text 'Instructions' in the instruction window.  The
  241.     ;; dialog box has two buttons, labeled "Yes" and "No".  The string
  242.     ;; 'Default' should be either "Yes" or "No" to specify which button is
  243.     ;; the default button.  After a button is pushed, the variable
  244.     ;; 'Variable' is set to the string "Yes" or the string "No" as
  245.     ;; appropriate.
  246.     ;;
  247.  
  248. AskYesNo (Prompt, "Yes",
  249.     "There may not be enough space to install the Multimedia Viewer.  "
  250.     "Would you like to enter a new path for the files?  ",
  251.     "Click on {\b Yes} or press {\b 'Y'} to enter a new path for the "
  252.     "Multimedia Viewer files.\par "
  253.     "Click on {\b No} or press {\b 'N'} to continue anyway.\par "
  254.     "Click on the {\b Exit} button or press {\b F3} to exit Setup.  "
  255.     "You may wish to exit Setup and make some more space on your hard "
  256.     "disk.  Run Setup again when there is enough space on your hard "
  257.     "disk.  ")
  258. IfEqualGoto (<Prompt>, "Yes", PromptViewerDestDir)
  259.  
  260.  
  261. ViewerDestDirOK:
  262. AskYesNo (AskAgain, "No", 
  263.     "Would you like to change anything before proceeding with "
  264.     "the installation?",
  265.     "Click on {\b Yes} or press {\b 'Y'} to reenter options.\par "
  266.     "Click on {\b No} or press {\b 'N'} to proceed with installation.  ")
  267. IfEqualGoto (<AskAgain>, "Yes", AskAgain)
  268.  
  269.     ;;
  270.     ;; MakePath (Path)
  271.     ;; ---------------
  272.     ;; This command causes the path 'Path' to be created if it does not
  273.     ;; already exist.  To make the path, MakePath creates any
  274.     ;; subdirectories that do not already exist.  If the path cannot be
  275.     ;; created, then no error will be reported, as the problem will
  276.     ;; normally be detected when Setup attempts to copy files to this
  277.     ;; path.
  278.     ;;
  279.  
  280. ; Create the tree structure.
  281. ;
  282. MakePath (<ViewerDestDir>)
  283.  
  284.     ;;
  285.     ;; OpenCopyProgress (Message, Instructions)
  286.     ;; ----------------------------------------
  287.     ;; This command begins a file manipulation section.  The command will
  288.     ;; open a progress bar dialog with the message 'Message' and the
  289.     ;; instruction text 'Instructions'.  Following this command, only the
  290.     ;; commands 'SetProgressBarMsg', 'PromptChangeDisk', 'CopyFile',
  291.     ;; 'AppendFile', 'UpdateFile', 'TranslateFile', 'DeleteFile', 
  292.     ;; 'RenameFile', 'Goto', 'IfEqualGoto', 'IfNotEqualGoto', 'ErrorExit',
  293.     ;; 'IfLowerGoto', 'IfHigherGoto', 'IfFileExistsGoto', 'Pause', and
  294.     ;; 'MakePath' are allowed until the 'CloseCopyProgress' command is
  295.     ;; reached.  An error is reported and Setup is aborted if any other
  296.     ;; commands are encountered while the progress bar is displayed.
  297.     ;;
  298.  
  299. ; Copy the files
  300. ;
  301. OpenCopyProgress (
  302.     "Setup is copying the Multimedia Viewer runtime files.",
  303.     "Please wait while Setup is copying files.")
  304.  
  305.     ;;
  306.     ;; CopyFile (Source, Destination, Size)
  307.     ;; ------------------------------------
  308.     ;; This command copies the file 'Source' to the file 'Destination'.
  309.     ;; The current disk and directory will be that of the Setup 
  310.     ;; executable.  Normally the files to copy will be in the same place
  311.     ;; (although a volume change may be required---see PromptChangeDisk)
  312.     ;; so a relative path is normally used for the source file name.
  313.     ;; Normally variables are used to specify a complete destination file
  314.     ;; name that depends on the user's path selection.  Any directories 
  315.     ;; specified in the destination path must already exist---they are
  316.     ;; normally created using the MakePath commands. 
  317.     ;;
  318.     ;; The 'Size' field specifies the size of the source file.  In order
  319.     ;; to initialize the progress bar it is necessary to find the total
  320.     ;; number of bytes to copy between the OpenCopyProgress command and
  321.     ;; the CloseCopyProgress command.  Since files may span several disks,
  322.     ;; it would be impractical to obtain this size directly from the 
  323.     ;; source file.  The size field is only required to maintain the
  324.     ;; progress bar, and, although it need not be exact, it should be
  325.     ;; close to reality to maintain the accuracy of the progress bar.
  326.     ;;
  327.     ;; If an error occurs (such as File Not Found, Read Error, Write 
  328.     ;; Error) then an error dialog is shown, at which point the user has
  329.     ;; the option to Abort Setup, Retry the copy operation, or Ignore the
  330.     ;; copy error.  Selecting Abort has the same effect as pressing <F3>. 
  331.     ;; Selecting Retry causes the operation to be retried.  Finally,
  332.     ;; selecting Ignore causes copying to continue despite the error.  The
  333.     ;; latter option will likely result in an incomplete Setup.  The
  334.     ;; command 'IfIncompleteGoto' can be used subsequently to give the 
  335.     ;; user an appropriate message.
  336.     ;;
  337.     ;; Files compressed using the Windows SDK COMPRESS utility will 
  338.     ;; automatically be decompressed as they are being copied to the hard
  339.     ;; disk. 
  340.     ;;
  341.  
  342. CopyFile ("FTENGINE.DLL", <ViewerDestDir> "FTENGINE.DLL",  50000)
  343. CopyFile ("FTUI.DLL",     <ViewerDestDir> "FTUI.DLL",      75000)
  344. CopyFile ("MMP.DLL",      <ViewerDestDir> "MMP.DLL",      200000)
  345. CopyFile ("MVAFF.DLL",    <ViewerDestDir> "MVAFF.DLL",     50000)
  346. CopyFile ("MVAPI.DLL",    <ViewerDestDir> "MVAPI.DLL",     10000)
  347. CopyFile ("MVAUDDLG.DLL", <ViewerDestDir> "MVAUDDLG.DLL",  50000)
  348. CopyFile ("MVAUDIO.DLL",  <ViewerDestDir> "MVAUDIO.DLL",   10000)
  349. CopyFile ("MVBMP.DLL",    <ViewerDestDir> "MVBMP.DLL",     50000)
  350. CopyFile ("QKHOOK.DLL",   <ViewerDestDir> "QKHOOK.DLL",    10000)
  351. CopyFile ("QUICKEYS.EXE", <ViewerDestDir> "QUICKEYS.EXE",  25000)
  352. CopyFile ("VIEWER.EXE",   <ViewerDestDir> "VIEWER.EXE",   250000)
  353. CopyFile ("DISPDIB.DLL",  <SystemPath>    "DISPDIB.DLL",   10000)
  354. CopyFile ("VER.DLL",      <SystemPath>    "VER.DLL",       80000)
  355. CopyFile ("QUICKEYS.HLP", <ViewerDestDir> "QUICKEYS.HLP",  25000)
  356. CopyFile ("PAGEFLIP.EXE", <ViewerDestDir> "PAGEFLIP.EXE",  25000)
  357.  
  358.     ;;
  359.     ;; CloseCopyProgress ()
  360.     ;; --------------------
  361.     ;; This command closes the copy progress bar.
  362.     ;;
  363.  
  364. CloseCopyProgress ()
  365.  
  366.     ;;*************Begin Title Specific Section***************************
  367.  
  368. ;;
  369.     ;; OpenProgmanProgress (Message, Instructions)
  370.     ;; -------------------------------------------
  371.     ;; This command begins a Program Manager installation section.
  372.     ;; This command will put up a progress bar with the message 'Message'
  373.     ;; and the instructions 'Instructions'.  Following this command, only
  374.     ;; the commands 'SetProgressBarMsg', 'OpenProgmanGroup', 'ErrorExit',
  375.     ;; 'AddProgmanItem', 'Goto', 'IfEqualGoto', 'IfNotEqualGoto',
  376.     ;; 'IfLowerGoto', 'IfHigherGoto', 'IfFileExistsGoto', and 'Pause' are
  377.     ;; allowed until the 'CloseProgmanProgress' command is reached.  An
  378.     ;; error is reported and Setup is aborted if any other commands are
  379.     ;; encountered while the progress bar is displayed.
  380.     ;;
  381.  
  382. ; Begin adding Progam Manager groups
  383. ;
  384. OpenProgmanProgress (
  385.     "Setup is adding Program Manager groups.",
  386.     "Please wait while Setup adds {\b Program Manager} groups".)
  387.  
  388.     ;;
  389.     ;; OpenProgmanGroup (Group[,  DeleteFlag])
  390.     ;; ---------------------------------------
  391.     ;; This command will set up a DDE conversation with the Program 
  392.     ;; Manager and open the program group entitled 'Group'.  If the 
  393.     ;; optional string 'Delete' is specified and is equal to "Delete", 
  394.     ;; then the specified group will be deleted if it exists, before it is
  395.     ;; created.  Normally this Delete flag is specified to create a new 
  396.     ;; program group, and is omitted to add to an existing group. 
  397.     ;; 
  398.     ;; The progress bar will display the words "Opening" followed by the
  399.     ;; name of the ProgMan group.  If OpenProgmanGroup fails then no error
  400.     ;; is reported.
  401.     ;;
  402.  
  403. ; Add a specific Program Manager group.
  404. ;
  405. OpenProgmanGroup (<TitleName>, Delete)    ;; Add the group named after the title
  406.  
  407.     ;;
  408.     ;; AddProgmanItem (Item, Command, IconFile, IconNumber)
  409.     ;; ----------------------------------------------------
  410.     ;; This command will add a new icon to the Program Manager group 
  411.     ;; opened by OpenProgmanGroup.  The icon will have the title 'Item',
  412.     ;; the command string 'Command', the icon file 'IconFile' and the
  413.     ;; 0-based icon index within the icon file 'IconNumber'.  Variables
  414.     ;; can be used to specify a complete path for the command and icon
  415.     ;; files that are dependent on the user's path choices.
  416.     ;;
  417.     ;; The progress bar will display the words "Adding" followed by the 
  418.     ;; item name.  If AddProgramItem fails then no error is reported.
  419.     ;;
  420.  
  421. AddProgmanItem (<TitleName>,
  422.     <ViewerDestDir> "VIEWER.EXE " <ViewerSrcDir>"QUIXOTE\"<TitleMVB> ".MVB",
  423.     <ViewerSrcDir>
  424.         "QUIXOTE\EBOOK.ICO",    ;; Change this to be the icon (ICO)
  425.                     ;;  file for the title.
  426.     0)
  427.  
  428.     ;;
  429.     ;; CloseProgmanProgress ()
  430.     ;; -----------------------
  431.     ;; This command closes the ProgMan DDE conversation.
  432.     ;;
  433.  
  434. CloseProgmanProgress ()
  435.  
  436.  
  437.     ;;
  438.     ;; AddToProfileIni (File, Tag, Name, Value)
  439.     ;; ----------------------------------------
  440.     ;; This command is identical to AddToWinIni, except that any profile
  441.     ;; file can be used.  This can be used to access the SYSTEM.INI file
  442.     ;; and any other private profile files.  No error is reported if this
  443.     ;; operation fails.
  444.     ;;
  445.  
  446. ; Update VIEWER.INI.
  447. ;
  448. AddToProfileIni ("VIEWER.INI", <TitleMVB>, "Path", 
  449.     <ViewerSrcDir> <TitleSrcDir>)
  450. AddToProfileIni ("VIEWER.INI", "Files", <TitleMVB> ".MVB", 
  451.     <ViewerSrcDir> <TitleSrcDir>
  452.     ",Please insert the " <TitleName> " CD in the CD-ROM drive")
  453.  
  454.     ;;    For each of the other books in a multiple-book title, add
  455.     ;;    a VIEWER.INI section that is named after the basename of
  456.     ;;    that book's MVB file (which should be in the same directory
  457.     ;;    as the main title's MVB file).
  458.     ;;
  459. AddToProfileIni ("VIEWER.INI", 
  460.     "QUIXOTE",        ; Basename of the MVB file
  461.     "Path", <ViewerSrcDir> <TitleSrcDir>)
  462.  
  463.     ;;***************End Title Specific Section***************************
  464.  
  465.     ;;
  466.     ;; AddToWinIni (Tag, Name, Value)
  467.     ;; ------------------------------
  468.     ;; This command adds or modifies the WIN.INI file entry 'Name' under
  469.     ;; the tag 'Tag' to equal the string 'Value'.  No error is reported if
  470.     ;; this operation fails.
  471.     ;;
  472.  
  473. ; Update WIN.INI.
  474. ;
  475. AddToWinIni ("Multimedia Viewer", "ViewerPath", <ViewerDestDir>)
  476. AddToWinIni ("Extensions", "mvb", "viewer.exe ^.mvb")
  477.  
  478.  
  479.     ;;
  480.     ;; ModifyAutoexec (Path, Lib, Include, AskInstructions, 
  481.     ;;        ReviewInstructions, SaveInstructions)
  482.     ;; ----------------------------------------------------
  483.     ;; This command ensures that the following environment variables in
  484.     ;; the AUTOEXEC.BAT file are set:
  485.     ;;
  486.     ;;    1. the path 'Path' is present in the PATH variable
  487.     ;;    2. the path 'Lib' is present in the LIB variable
  488.     ;;    3. the path 'Include' is present in the INCLUDE variable
  489.     ;; 
  490.     ;; If any of  'Path', 'Lib', or 'Include' is the null string (""),
  491.     ;; then the corresponding environment variable is ignored.
  492.     ;;
  493.     ;; If an environment variable needs to be changed, a dialog window
  494.     ;; is brought up.  If all the required paths are already in the
  495.     ;; current environment variables, then no dialog is shown.  The
  496.     ;; instruction window contains the instruction text 'AskInstructions'.
  497.     ;;
  498.     ;; If the default option to make the modifications is selected, then
  499.     ;; the old AUTOEXEC.BAT file is saved to AUTOEXEC.BAK and the required
  500.     ;; changes are made to the current AUTOEXEC.BAT file.  Paths are added
  501.     ;; to the beginning of the path list in the PATH, SET LIB, and
  502.     ;; SET INCLUDE statements.   If the statement to set the appropriate
  503.     ;; environment variable is not present then the statement is added to
  504.     ;; the end of the AUTOEXEC.BAT file.  If the AUTOEXEC.BAT file is not
  505.     ;; found, then a new AUTOEXEC.BAT file is created to contain these
  506.     ;; new statements.
  507.     ;;
  508.     ;; If the option to review and edit the changes is chosen then the
  509.     ;; following dialog is shown:
  510.     ;;
  511.     ;; The upper edit box shows the proposed changes to the AUTOEXEC.BAT
  512.     ;; file and the lower edit box shows the current AUTOEXEC.BAT file
  513.     ;; contents.  The instruction window shows the instructon text
  514.     ;; 'ReviewInstructions'.   Any changes made to the upper edit box are
  515.     ;; saved when the user clicks on the OK default button or presses
  516.     ;; <Enter> to save the changes.  The old AUTOEXEC.BAT is saved to the
  517.     ;; file AUTOEXEC.BAK before the changes are made.  The Cancel button
  518.     ;; brings back the previous dialog.
  519.     ;;
  520.     ;; If the option to make the modifications later is chosen then the
  521.     ;; following dialog is shown:
  522.     ;;
  523.     ;; Here the user can specify a file that will contain the
  524.     ;; modifications made to the AUTOEXEC.BAT file.  The instruction
  525.     ;; window shows the instruction text 'SaveInstructions'.  The default
  526.     ;; filename is AUTOEXEC.NEW, but the user can changes this by editing
  527.     ;; the file in the dialog box.  To save the changes to the specified
  528.     ;; file, the user clicks on the Save button or presses 'S' or Enter.
  529.     ;; To not save the changes, the user clicks on the Don't Save button.
  530.     ;; To return to the previous dialog, the user clicks on the Cancel
  531.     ;; button or presses Esc.
  532.     ;;
  533.  
  534. ; Add the Viewer path to the PATH variable in the environment.
  535. ;
  536. ModifyAutoexec (<ViewerDestDir>, "", "",
  537.     "Setup must now make some changes to your {\b AUTOEXEC.BAT} file.  "
  538.     "Click on the desired option and click on {\b OK} to continue.  With "
  539.     "the keyboard, use the arrow keys to select the desired option, and "
  540.     "then press {\b Enter} to continue.\par\par "
  541.     "{\b o} Select the first option to let Setup modify your "
  542.     "AUTOEXEC.BAT file\par "
  543.     "{\b o} Select the second option to view and change the changes "
  544.     "first\par "
  545.     "{\b o} Select the third option if you want to make the changes "
  546.     "yourself later on\par\par ",
  547.     "You can now view the proposed changes to the {\b AUTOEXEC.BAT} "
  548.     "file.  If the changes were not made to your satisfaction, you can "
  549.     "modify the proposed batch file by editing the file in the top "
  550.     "window.  Click on {\b OK} or press {\b Enter} to replace the "
  551.     "current batch file with the proposed one.  To return to the "
  552.     "AUTOEXEC modification options dialog, click on {\b Cancel} or press "
  553.     "{\b Esc}.", 
  554.     "Setup can save the proposed {\b AUTOEXEC.BAT} file to a file that "
  555.     "you specify.  You will have to modify your own {\b AUTOEXEC.BAT} "
  556.     "file yourself and then reboot your computer in order for the Viewer "
  557.     "to function normally.  To return to the AUTOEXEC modification "
  558.     "options dialog, click on {\b Cancel} or press {\b Esc}.")
  559.  
  560. ; Assemble and display finished message
  561.  
  562.     ;;
  563.     ;; IfIncompleteGoto (Label)
  564.     ;; ------------------------
  565.     ;; This command will branch to the label 'Label' if the installation
  566.     ;; was incomplete.  The installation is incomplete if there was an
  567.     ;; error for any file that was copied to the hard disk and the user
  568.     ;; specified to ignore the error.  The installation is also incomplete
  569.     ;; if the 'SetIncomplete' command was executed.
  570.     ;;
  571.  
  572. IfIncompleteGoto (Incomplete)
  573.     SetVariable (Message, 
  574.         "%nThe Setup program has successfully installed%n"
  575.         "the Multimedia Viewer and "<TitleName> ".%n%n")
  576.     Goto (CheckAutoexec)
  577. Incomplete:
  578.     SetVariable (Message,
  579.         "Setup has finished, but the installation was incomplete.  "
  580.         "You should correct any problems (such as insufficient disk "
  581.         "space, missing source files, or locked directories) and run "
  582.         "Setup again.%n%n")
  583.  
  584.  
  585. CheckAutoexec:
  586.  
  587.     ;;
  588.     ;; IfMustModifyGoto (Label)
  589.     ;; ------------------------
  590.     ;; This command will branch to the label 'Label' if Setup had to 
  591.     ;; modify the AUTOEXEC.BAT file, but the user chose to do the
  592.     ;; modifications themselves later.  The command will also branch
  593.     ;; if the 'SetMustModify' command was executed.
  594.     ;;
  595.  
  596. IfMustModifyGoto (MustModify)
  597.  
  598.     ;;
  599.     ;; IfMustRebootGoto (Label)
  600.     ;; ------------------------
  601.     ;; This command will branch to the label 'Label' if Setup has
  602.     ;; modified the AUTOEXEC.BAT file, and the user
  603.     ;; must now reboot the computer.  The command will also branch
  604.     ;; if the 'SetMustReboot' command was executed.
  605.     ;;
  606.  
  607. IfMustRebootGoto (MustReboot)
  608. Goto (End)
  609.  
  610.  
  611. MustModify:
  612.  
  613. SetVariable (Message, 
  614.     <Message> "Remember to modify your AUTOEXEC.BAT file and reboot your "
  615.     "computer before using the Multimedia Viewer.%n%n")
  616. Goto (End)
  617.  
  618.  
  619. MustReboot:
  620.  
  621. SetVariable (Message,
  622.     <Message> "For the changes made by Setup to come into "
  623.     "effect, you must reboot your computer.  To do this, you must first "
  624.     "exit Windows and then simultaneously hold down the Ctrl, Alt, and "
  625.     "Del keys.  You must do this before using the Multimedia Viewer.%n%n")
  626.  
  627.  
  628. End:
  629.  
  630. SetVariable (Message, 
  631.     <Message> "%nThe advantages of being a registered user are numerous.%n"
  632.     "Please send in your Product Registration Card TODAY.")
  633.  
  634. DisplayMessage (<Message>, 
  635.     "Click on {\b OK} or press {\b Enter} to return to the "
  636.     "Program Manager.")
  637.  
  638.  
  639.     ;;
  640.     ;; The following are other commands that Setup recognizes
  641.     ;;
  642.     ;;
  643.     ;; IfNotEqualGoto (String1, String2, Label)
  644.     ;; ----------------------------------------
  645.     ;; This command will do a case insensitive compare on the strings
  646.     ;; 'String1' and 'String2' and branch to 'Label' if they do not match.
  647.     ;;
  648.     ;; IfHigherGoto (Number1, Number2, Label)
  649.     ;; --------------------------------------
  650.     ;; This command will compare 'Number1' and 'Number2', which are
  651.     ;; strings interpreted as long integers.  If 'Number1' is higher 
  652.     ;; than 'Number2' then execution branches to 'Label'.
  653.     ;;
  654.     ;; Add (Variable, Number)
  655.     ;; --------------------------
  656.     ;; This command will add the value 'Number' to the old value of the
  657.     ;; variable 'Variable', and store the result as the new value of
  658.     ;; 'Variable'.  Both the old value of 'Variable' and the string
  659.     ;; 'Number' are interpreted as long integers.
  660.     ;;
  661.     ;; Subtract (Variable, Number)
  662.     ;; -------------------------------
  663.     ;; This command will subtract the value 'Number' from the old value
  664.     ;; of the variable 'Variable', and store the result as the new value
  665.     ;; of 'Variable'.  Both the old value of 'Variable' and the string
  666.     ;; 'Number' are interpreted as long integers.
  667.     ;;
  668.     ;; SetProgressBarMsg (Message)
  669.     ;; ---------------------------
  670.     ;; This command changes the progress bar message to 'Message'.
  671.     ;; This is used to let the user know which group of files is currently
  672.     ;; being copied.
  673.     ;;
  674.     ;; GetWinSystemPath (Variable)
  675.     ;; ---------------------------
  676.     ;; This command sets the variable 'Variable' to the path of the
  677.     ;; Windows System directory.  The directory name ends in a backslash.
  678.     ;;
  679.     ;; Confirm (Variable, Default, Text, Instructions)
  680.     ;; -----------------------------------------------
  681.     ;; This command behaves identically to the AskYesNo command, except
  682.     ;; that it is used to confirm that the options that have been entered
  683.     ;; are correct.  The string 'Text' is normally built from the answers
  684.     ;; to the other prompt commands.
  685.     ;;
  686.     ;; PromptChangeDisk (DiskLabel, File, Instructions)
  687.     ;; ------------------------------------------------
  688.     ;; This command pops up a dialog window requesting the user to insert
  689.     ;; the disk labeled 'DiskLabel' into the current drive.  When the user
  690.     ;; clicks on the "OK" button or presses Enter, Setup checks to see
  691.     ;; that the file with the given name exists.  If the file does not
  692.     ;; exist then Setup assumes that the wrong disk was inserted and the
  693.     ;; dialog remains active.  This is repeated until the file is found,
  694.     ;; at which time the dialog box is removed and execution continues.
  695.     ;;
  696.     ;; UpdateFile (Source, Destination, Size)
  697.     ;; --------------------------------------
  698.     ;; This command is identical to the CopyFile command, except that if
  699.     ;; the destination file exists then it will read the version number
  700.     ;; of the source and the destination files and perform the copy only
  701.     ;; if the version number of the source file is higher than that of the
  702.     ;; destination file.  The source file must not be compressed for this
  703.     ;; to work.
  704.     ;;
  705.     ;; AppendFile (Source, Destination, Size)
  706.     ;; --------------------------------------
  707.     ;; This command is identical to the CopyFile command, except that the
  708.     ;; source file is appended to the destination file.  This command is 
  709.     ;; useful for copying files that span several volumes.
  710.     ;;
  711.     ;; Files compressed using the Windows SDK COMPRESS utility will
  712.     ;; automatically be decompressed as they are being copied to the hard
  713.     ;; disk. 
  714.     ;;
  715.     ;; TranslateFile (Source, Destination, Size, Tag1, Replacement1, 
  716.     ;;         Tag2, Replacement2, ...)
  717.     ;; -------------------------------------------------------------
  718.     ;; The TranslateFile command behaves just like the CopyFile command,
  719.     ;; except that all strings enclosed in double angle brackets (<<...>>)
  720.     ;; in the source file are treated as "tags" which, together with the
  721.     ;; angle brackets, get replaced by the corresponding replacement
  722.     ;; strings in the destination file.
  723.     ;;
  724.     ;; For instance, if the source file "SOURCE.BAT" contains the line
  725.     ;;
  726.     ;;     set WinDir=<<WinDir>>
  727.     ;;
  728.     ;; and the following commands are used to copy the file
  729.     ;;
  730.     ;;    GetWinPath (WindowsDir)
  731.     ;;    .
  732.     ;;    .
  733.     ;;    TranslateFile ("SOURCE.BAT", "DEST.BAT", 1000, 
  734.     ;;        "WinDir", <WindowsDir>)
  735.     ;;
  736.     ;; then the file "DEST.BAT" will contain the following line:
  737.     ;;
  738.     ;;    set WinDir=C:\WIN
  739.     ;;
  740.     ;; The tag can be up to 127 characters long.  If the tag is not listed
  741.     ;; with its replacement string then the tag and its angle brackets
  742.     ;; will not be present in the destination file.
  743.     ;;
  744.     ;; The source file can be compressed.  This command is not 
  745.     ;; particularly fast, so it is only suited for short files, like INI
  746.     ;; files and BAT files.
  747.     ;;
  748.     ;; RenameFile (CurrentName, NewName)
  749.     ;; ---------------------------------
  750.     ;; This command renames the file specified by 'CurrentName' to
  751.     ;; 'NewName'.  No error is reported if this command fails.
  752.     ;;
  753.     ;; DeleteFile (FileName)
  754.     ;; ---------------------
  755.     ;; This command deletes the file specified by 'FileName', if this
  756.     ;; file exists.  No error is reported if this command fails.
  757.     ;;
  758.     ;; GetFromProfileIni (Variable, File, Tag, Name, Default)
  759.     ;; ------------------------------------------------------
  760.     ;; This command is identical to GetFromWinIni except that any profile
  761.     ;; file can be used.
  762.     ;;
  763.     ;; Pause (Time)
  764.     ;; ------------
  765.     ;; This command will pause execution in the script file for the
  766.     ;; specified number of milliseconds.  This command can be used when
  767.     ;; copying files or modifying the Program Manager groups in order to
  768.     ;; give the user time to see what is happening.
  769.     ;;
  770.     ;; Execute (CommandString, DisplayType)
  771.     ;; ------------------------------------
  772.     ;; This command will launch the program specified in the string
  773.     ;; 'CommandString'.  Parameters can appear following the program name.
  774.     ;; The argument 'DisplayType' determines whether the program window is
  775.     ;; shown as hidden, normal, minimized, or maximized, as specified in
  776.     ;; the following table:
  777.     ;;
  778.     ;;    'DisplayType'                Effect
  779.     ;;        0            Window appears hidden
  780.     ;;        1            Window appears normal
  781.     ;;        2            Window appears minimized
  782.     ;;        3            Window appears maximized
  783.     ;;
  784.     ;; ErrorExit (Text)
  785.     ;; ---------------------
  786.     ;; This command forces Setup to exit after a fatal error.  A message
  787.     ;; box pops up with the message 'Text' explaining the error, and then
  788.     ;; Setup ends.
  789.     ;;
  790.     ;; SendWinIniChange (Section)
  791.     ;; --------------------------
  792.     ;; This command broadcasts a WM_WININICHANGE message to all top-level
  793.     ;; windows when changes have been made to the section 'Section' in
  794.     ;; the Windows initialization file, WIN.INI.  The section name does
  795.     ;; not include the square brackets.
  796.     ;;
  797.     ;; SendDevModeChange (Device)
  798.     ;; --------------------------
  799.     ;; This command broadcasts a WM_DEVMODECHANGE message to all top-level
  800.     ;; windows when changes have been made to the device-mode settings
  801.     ;; of the device 'Device'.
  802.     ;;
  803.     ;; ParseField (Variable, String, FieldPosition)
  804.     ;; --------------------------------------------
  805.     ;; This command sets the variable 'Variable' to be the field specified
  806.     ;; by the number 'FieldPosition' in the string 'String'.  Fields are
  807.     ;; separated by commas.  The first field in a string is in position 1.
  808.     ;; If the field position is out of bounds, or there is some other
  809.     ;; kind of error, then 'Variable' is set to an empty string.
  810.     ;;
  811.     ;; For example, 
  812.     ;;
  813.     ;;    ParseField (Var1, "Position 1, Position 2", 2)
  814.     ;;
  815.     ;; would set the variable 'Var1' to be "Position 2".
  816.     ;;
  817.     ;; MidString (Variable, String, StartPos, Span)
  818.     ;; --------------------------------------------
  819.     ;; This command sets the variable 'Variable' to be a substring of the
  820.     ;; string 'String'.  The substring starts at position 'StartPos' in
  821.     ;; the source string (which is 0-based) and is 'Span' characters long.
  822.     ;; If there are not enough characters in the string at position
  823.     ;; 'StartPos' to form the substring, then as many characters as
  824.     ;; possible will be formed from that position onward.  If 'StartPos'
  825.     ;; is not within the string, a fatal error will result.
  826.     ;;
  827.     ;; OpenMessageBox (Text, Instructions)
  828.     ;; -----------------------------------
  829.     ;; This command displays the message 'Text' in a dialog box and the
  830.     ;; instruction text 'Instructions' in the instructions window.
  831.     ;; The dialog box remains until a 'CloseMessageBox' command is
  832.     ;; issued.  Other commands can occur in the setup script between the
  833.     ;; 'OpenMessageBox' and 'CloseMessageBox' commands.
  834.     ;;
  835.     ;; CloseMessageBox ()
  836.     ;; ------------------
  837.     ;; This command closes a dialog box that was opened with the
  838.     ;; 'OpenMessageBox' command.
  839.     ;;
  840.     ;; FileErrorBox (Variable, Message, File)
  841.     ;; --------------------------------------
  842.     ;; This command puts up a dialog to handle file errors.  The dialog
  843.     ;; box contains three buttons: Abort, Retry, and Ignore.  Retry is
  844.     ;; the default button.  The box contains an error message 'Message'
  845.     ;; followed by the file 'File' that is in question.
  846.     ;;
  847.     ;; If the Ignore button is pressed, the variable 'Variable' is set to
  848.     ;; the string "Ignore".  If the Retry button is pressed, 'Variable' is
  849.     ;; set to "Retry".  If the Abort button is pressed, a dialog box will
  850.     ;; ask if the user wants to end Setup.  If the user chooses Yes, then
  851.     ;; Setup will end.  If the user chooses No, then 'Variable' is set
  852.     ;; to "Retry".
  853.     ;;
  854.     ;; SetIncomplete ()
  855.     ;; ----------------
  856.     ;; This command indicates that the installation was incomplete, 
  857.     ;; causing the 'IfIncompleteGoto' command to branch to the label
  858.     ;; in its argument list.
  859.     ;;
  860.     ;; SetMustModify ()
  861.     ;; ----------------
  862.     ;; This command indicates that Setup had to modify the AUTOEXEC.BAT 
  863.     ;; file, but the user chose to do the modifications later.  This will
  864.     ;; cause the 'IfMustModifyGoto' command to branch to the label
  865.     ;; in its argument list.
  866.     ;;
  867.     ;; SetMustReboot ()
  868.     ;; ----------------
  869.     ;; This command indicates that Setup has altered the system so that
  870.     ;; the user must reboot the computer for these changes to come into
  871.     ;; effect.  This will cause the 'IfMustRebootGoto' command to branch
  872.     ;; to the label in its argument list.
  873.     ;;
  874.     ;; EnumerateWinIni (Variable, Section)
  875.     ;; -----------------------------------
  876.     ;; This command enumerates the key names associated with the section
  877.     ;; 'Section' of WIN.INI.  The key names will be separated by commas,
  878.     ;; and will be stored in the variable 'Variable'.  If 'Section' does
  879.     ;; not exist, or there is some other error, then 'Variable' will be
  880.     ;; set to the empty string.  Do not specify the brackets '[' and ']'
  881.     ;; in 'Section'.
  882.     ;;
  883.     ;; EnumerateProfileIni (Variable, File, Section)
  884.     ;; ---------------------------------------------
  885.     ;; This command is identical to 'EnumerateWinIni' except that it 
  886.     ;; operates on any initialization file specified by the name 'File'.
  887.     ;;
  888.  
  889.     ;;
  890.     ;; Subroutines
  891.     ;; -----------
  892.     ;; Subroutines can be implemented in the Setup script using the 
  893.     ;; mechanism described as follows (an example subroutine call is 
  894.     ;; provided for the installation of PostScript fonts).
  895.     ;;
  896.     ;; A subroutine may require various input and output variables.  The
  897.     ;; input variables should be set before calling the subroutine.  These
  898.     ;; variables may be altered within the subroutine; do not expect them
  899.     ;; to remain constant.  After the subroutine returns, the output 
  900.     ;; variables contain the output values.  A special variable,
  901.     ;; 'Continuation', must also be set to contain the label at which
  902.     ;; the execution resumes after the subroutine returns.  Normally,
  903.     ;; this label will be immediately after the subroutine call.  The
  904.     ;; subroutine call itself is made by a 'Goto' statement to the 
  905.     ;; subroutine's entry label.
  906.     ;;
  907.     ;;    NOTE: All variables are global!
  908.     ;;
  909.     ;; The code for a subroutine requires certain statements.  The
  910.     ;; first statement should be a 'Goto' statement that skips over
  911.     ;; the entire subroutine so that it will only be activated if it is 
  912.     ;; explicitly called.  Thus, the last statement of the subroutine
  913.     ;; should be a label to which the first 'Goto' jumps to.  The second
  914.     ;; statement in the subroutine should be the entry label of the
  915.     ;; subroutine.  The next to last statement of the subroutine should
  916.     ;; be the statement 'Goto (<Continuation>)', which allows the 
  917.     ;; subroutine to return.  For the example PostScript font installation
  918.     ;; subroutine, the first and last lines are as follows:
  919.     ;;
  920.     ;;
  921.     ;;        Goto (subInstallPSFontEnd)
  922.     ;;        subInstallPSFont:
  923.     ;;        ;
  924.     ;;        ; {body of the subroutine}
  925.     ;;        ;
  926.     ;;        Goto (<Continuation>)
  927.     ;;        subInstallPSFontEnd:
  928.     ;;
  929.     ;;
  930.  
  931.     ;;
  932.     ;; Subroutine Code: subInstallPSFont
  933.     ;; ---------------------------------
  934.     ;; This subroutine installs PostScript fonts which consist of a
  935.     ;; Windows font metric table file (.PFM) and a PostScript font file
  936.     ;; (.PFA) for each font.
  937.     ;;
  938.     ;; Subroutine entry label:
  939.     ;;    subInstallPSFont
  940.     ;; Input variables:
  941.     ;;    MetricBase - base name of the Windows font metric table file
  942.     ;;    FontBase - base name of the PostScript font file
  943.     ;;    MetricPath - full pathname of metric file
  944.     ;;    FontPath - full pathname of font file
  945.     ;; Output variables:
  946.     ;;    (none)
  947.     ;; Continuation variable:
  948.     ;;    Continuation
  949.     ;;
  950.  
  951.     ;; Skip over the subInstallPSFont subroutine.  It will be activated
  952.     ;; only if it is explicitly "called".
  953.     ;;
  954. Goto (subInstallPSFontEnd)    
  955.  
  956.     ;; Begin the subInstallPSFont subroutine.
  957.     ;;
  958. subInstallPSFont:
  959.  
  960.     ; Local constant: Printer name.  Used in dialog boxes.
  961.     ;
  962. SetVariable (ipfPrinterName, "PostScript")
  963.  
  964.     ; Local constant: Subroutine name.  Used in error dialog boxes.
  965.     ;
  966. SetVariable (ipfSubroutineName, "subInstallPSFont")
  967.  
  968.     ; Local constant: Printer driver.  Basename of the driver for which
  969.     ; we are installing fonts.
  970.     ;
  971. SetVariable (ipfDriver, "PSCRIPT")
  972.  
  973.     ; Local constant: Destination directory for the metric and
  974.     ; font files.  We will put them into the Windows system directory.
  975.     ;
  976. GetWinSystemPath (ipfSystemPath)
  977.  
  978.  
  979. OpenMessageBox (
  980.     "Setup is installing the " <ipfPrinterName> " font consisting of "
  981.     <MetricBase> " and " <FontBase> ".",
  982.     "Please wait while Setup installs " <ipfPrinterName> " fonts.")
  983.  
  984.  
  985.     ; Check if the metric and font files exist.
  986.     ;
  987. ipfCheckMetricPath:
  988. IfFileExistsGoto (<MetricPath>, ipfMetricExists)
  989.     FileErrorBox (ipfTmp , "The following file was not found:", 
  990.         <MetricPath>)
  991.     IfEqualGoto (<ipfTmp>, "Retry", ipfCheckMetricPath)
  992.     SetIncomplete ()
  993.     Goto (ipfFinished)
  994. ipfMetricExists:
  995.  
  996. ipfCheckFontPath:
  997. IfFileExistsGoto (<FontPath>, ipfFontExists)
  998.     FileErrorBox (ipfTmp , "The following file was not found:", 
  999.         <FontPath>)
  1000.     IfEqualGoto (<ipfTmp>, "Retry", ipfCheckFontPath)
  1001.     SetIncomplete ()
  1002.     Goto (ipfFinished)
  1003. ipfFontExists:
  1004.  
  1005.  
  1006.     ; Enumerate the different printers.  This information is found in the
  1007.     ; 'PrinterPorts' section of WIN.INI.
  1008.     ;
  1009. EnumerateWinIni (ipfPrinterPorts, "PrinterPorts")
  1010. IfNotEqualGoto (<ipfPrinterPorts>, "", ipfPrinterPortsOK)
  1011.     DisplayMessage (<ipfSubroutineName> ": "
  1012.         "There are no printers installed.%n%n"
  1013.         "The " <ipfPrinterName> " font consisting of " <MetricBase> 
  1014.         " and " <FontBase> " was not installed.",
  1015.         "")
  1016.     SetIncomplete ()
  1017.     Goto (ipfFinished)
  1018. ipfPrinterPortsOK:
  1019.  
  1020.  
  1021.     ; For each printer in the 'PrinterPorts' section, find out its
  1022.     ; associated printer information.  For example, ipfPrinterInfo might
  1023.     ; be "PSCRIPT,LPT2:,15,45,COM2:,15,45".  If the first field in the
  1024.     ; printer information matches the desired printer driver (ipfDriver),
  1025.     ; then install the fonts for each printer listed in the printer 
  1026.     ; information.
  1027.     ;
  1028. SetVariable (ipfPortIndex, 1)
  1029. ipfPortLoop:
  1030. ParseField (ipfPrinter, <ipfPrinterPorts>, <ipfPortIndex>)
  1031.     IfEqualGoto (<ipfPrinter>, "", ipfFinished)    ; End port loop
  1032. GetFromWinIni (ipfPrinterInfo, "PrinterPorts", <ipfPrinter>, "NONE")
  1033. IfNotEqualGoto (<ipfPrinterInfo>, "NONE", ipfPrinterInfoOK)
  1034.     DisplayMessage (<ipfSubroutineName> ": "
  1035.         "There was an error reading the '" <ipfPrinter> "' entry in "
  1036.         "the 'PrinterPorts' section of WIN.INI.%n%n",
  1037.         "The " <ipfPrinterName> " font consisting of " <MetricBase> 
  1038.         " and " <FontBase> " may not be completely installed.",
  1039.         "")
  1040.     SetIncomplete ()
  1041.     Goto (ipfPortInc)
  1042. ipfPrinterInfoOK:
  1043. ParseField (ipfDrv, <ipfPrinterInfo>, 1)
  1044. IfEqualGoto (<ipfDrv>, <ipfDriver>, ipfInstall)
  1045. ipfPortInc:
  1046. Add (ipfPortIndex, 1)
  1047. Goto (ipfPortLoop)
  1048.  
  1049.  
  1050. ipfInstall:
  1051.     ; Install the font for each PostScript printer
  1052.     ;
  1053. SetVariable (ipfIndex, 2)
  1054. ipfInstallLoop:
  1055. ParseField (ipfPrinterField, <ipfPrinterInfo>, <ipfIndex>)
  1056.     IfEqualGoto (<ipfPrinterField>, "", ipfPortInc)        ; End loop
  1057. MidString (ipfPort, <ipfPrinterField>, 0, 4)    ; Assume port names are 4
  1058.                         ; characters long
  1059. IfNotEqualGoto (<ipfPort>, "", ipfPortOK)
  1060.     DisplayMessage (<ipfSubroutineName> ": "
  1061.         "The WIN.INI file is defective.%n%n"
  1062.         "The " <ipfPrinterName> " font consisting of " <MetricBase> 
  1063.         " and " <FontBase> " may not be completely installed.",
  1064.         "")
  1065.     SetIncomplete ()
  1066.     Goto (ipfInstallInc)
  1067. ipfPortOK:
  1068. SetVariable (ppfContinuation, ipfInstallInc)
  1069. Goto (subPrinterPSFont)
  1070. ipfInstallInc:
  1071. Add (ipfIndex, 3)
  1072. Goto (ipfInstallLoop)
  1073.  
  1074.  
  1075. ipfFinished:
  1076. CloseMessageBox ()
  1077.     ; Return from subroutine
  1078.     ;
  1079. Goto (<Continuation>)
  1080.  
  1081.  
  1082.     ;; End of subInstallPSFont subroutine
  1083.     ;;
  1084. subInstallPSFontEnd:
  1085.  
  1086.  
  1087.     ;;
  1088.     ;; Subroutine Code: subPrinterPSFont
  1089.     ;; ---------------------------------
  1090.     ;; This subroutine installs PostScript fonts for each PostScript
  1091.     ;; printer that is installed.  Each printer is identified by its
  1092.     ;; printer port (e.g. "LPT2").  This subroutine is called by the
  1093.     ;; subInstallPSFont subroutine.
  1094.     ;;
  1095.     ;; Subroutine entry label:
  1096.     ;;    subPrinterPSFont
  1097.     ;; Input variables:
  1098.     ;;    MetricBase - base name of the Windows font metric table file
  1099.     ;;    FontBase - base name of the PostScript font file
  1100.     ;;    MetricPath - full pathname of metric file
  1101.     ;;    FontPath - full pathname of font file
  1102.     ;;    ipfPort - printer port for the particular PostScript printer
  1103.     ;;    ipfSystemPath - destination directory for the metric and font
  1104.     ;;        files
  1105.     ;;    ipfPrinter - printer type
  1106.     ;; Output variables:
  1107.     ;;    (none)
  1108.     ;; Continuation variable:
  1109.     ;;    ppfContinuation
  1110.     ;;
  1111.  
  1112.     ;; Skip over the subPrinterPSFont subroutine.  It will be activated
  1113.     ;; only if it is explicitly "called".
  1114.     ;;
  1115. Goto (subPrinterPSFontEnd)
  1116.  
  1117.     ;; Begin the subPrinterPSFont subroutine.
  1118.     ;;
  1119. subPrinterPSFont:
  1120.  
  1121.  
  1122.     ; Local constant: Prefix for the WIN.INI section of this particular
  1123.     ; printer.
  1124.     ;
  1125. SetVariable (ppfPrefix, "PostScript,")
  1126.  
  1127.  
  1128.     ; Determine the destination paths of the metric and font files.
  1129.     ;
  1130. SetVariable (ppfMetricDest, <ipfSystemPath> <MetricBase>)
  1131. SetVariable (ppfFontDest, <ipfSystemPath> <FontBase>)
  1132.  
  1133.  
  1134.     ; Determine the value to store in the WIN.INI entry
  1135.     ;
  1136. SetVariable (ppfValue, <ppfMetricDest> "," <ppfFontDest>)
  1137.  
  1138.  
  1139.     ; Determine the section name of the printer, which is the section 
  1140.     ; prefix and the printer port separated by a comma.
  1141.     ;
  1142.     ; For example, Section may be "PostScript,LPT2" for a PostScript 
  1143.     ; printer connected to printer port #2.
  1144.     ;
  1145. SetVariable (ppfSection, <ppfPrefix> <ipfPort>)
  1146.  
  1147.  
  1148.     ; Determine the number of soft fonts already installed.
  1149.     ;
  1150. GetFromWinIni (ppfSoftFonts, <ppfSection>, "softfonts", 0)
  1151.  
  1152.  
  1153.     ; Check if the metric file or the font file has already been 
  1154.     ; installed.  The softfont index (ppfIndex) and the number of 
  1155.     ; softfonts encountered (ppfCount) may not be the same since the
  1156.     ; softfonts may not be numbered consecutively.
  1157.     ;
  1158. SetVariable (ppfIndex, 1)    ; softfont index
  1159. SetVariable (ppfCount, 1)    ; number of softfonts encountered
  1160. ppfCheckLoop:
  1161. IfHigherGoto (<ppfCount>, <ppfSoftFonts>, ppfLook)
  1162. GetFromWinIni(ppfFontEntry, <ppfSection>, "softfont" <ppfIndex>, "NONE")
  1163. IfEqualGoto (<ppfFontEntry>, "NONE", ppfCheckInc)    ; non-consecutive
  1164. IfEqualGoto (<ppfFontEntry>, <ppfValue>, ppfFinished)    ; already installed
  1165. Add (ppfCount, 1)
  1166. ppfCheckInc:
  1167. Add (ppfIndex, 1)
  1168. Goto (ppfCheckLoop)
  1169.  
  1170.  
  1171. ppfLook:
  1172.     ; Look for the first empty slot to put in the new softfont entry
  1173.     ;
  1174. SetVariable (ppfLookIndex, 1)
  1175. ppfLookLoop:
  1176. IfHigherGoto (<ppfLookIndex>, <ppfSoftFonts>, ppfInstall)
  1177. GetFromWinIni(ppfFontEntry, <ppfSection>, "softfont" <ppfLookIndex>, "NONE")
  1178. IfEqualGoto (<ppfFontEntry>, "NONE", ppfInstall)
  1179. ppfLookInc:
  1180. Add (ppfLookIndex, 1)
  1181. Goto (ppfLookLoop)
  1182.  
  1183.  
  1184. ppfInstall:
  1185.     ; Update the softfont fields in the WIN.INI file.
  1186.     ; Notify Windows that the WIN.INI file has changed.
  1187.     ;
  1188. Add (ppfSoftFonts, 1)
  1189. AddToWinIni (<ppfSection>, "softfonts", <ppfSoftFonts>)
  1190. AddToWinIni (<ppfSection>, "softfont" <ppfLookIndex>, <ppfValue>)
  1191. SendWinIniChange (<ppfSection>)
  1192.  
  1193.  
  1194. ppfFinished:
  1195.     ; Copy the metric and font files.  Do this in all cases since the
  1196.     ; metric and font files may have changed, although their names
  1197.     ; have not.
  1198.     ;
  1199. CopyFile (<MetricPath>, <ppfMetricDest>, 1)
  1200. CopyFile (<FontPath>, <ppfFontDest>, 1)
  1201.  
  1202.  
  1203.     ; Notify Windows that the font files for the printer driver have
  1204.     ; changed.
  1205.     ;
  1206. SendDevModeChange (<ipfPrinter>)
  1207.  
  1208.  
  1209.     ; Return from subroutine
  1210.     ;
  1211. Goto (<ppfContinuation>)
  1212.  
  1213.     ;; End of subPrinterPSFont subroutine
  1214.     ;;
  1215. subPrinterPSFontEnd:
  1216. 
  1217.