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