home *** CD-ROM | disk | FTP | other *** search
/ World Wide Web Directory / WWW_DIR_CD.iso / title.mst < prev    next >
Text File  |  1995-07-08  |  13KB  |  432 lines

  1. '**************************************************************************
  2. '*
  3. '* TITLE.MST - World Wide Web Directory Setup Script
  4. '*
  5. '**************************************************************************
  6.     
  7.     '' Global variables
  8.  
  9.     GLOBAL TitleShortName$
  10.     GLOBAL TitleLongName$
  11.     GLOBAL MVBFileName$
  12.     GLOBAL PromptForPath%
  13.     GLOBAL DefaultPath$
  14.     GLOBAL ProgManGroup$
  15.     GLOBAL ProgManItem$
  16.  
  17.     '' ****************************************************************
  18.     '' ** Setup Variables
  19.     '' ****************************************************************
  20.  
  21.     TitleShortName$ = "World Wide Web Directory"
  22.     
  23.     TitleLongName$ = "World Wide Web Directory"
  24.         
  25.     MVBFileName$ = "WWWDIR1"
  26.         
  27.     PromptForPath% = 1
  28.         
  29.     DefaultPath$ = "C:\WWWDIR"
  30.     
  31.     ProgManGroup$ = "World Wide Web Directory"
  32.     
  33.     ProgManItem$ = "World Wide Web Directory"
  34.     
  35.     '***********************************************************************
  36.     '** Mainline
  37.     '***********************************************************************
  38.  
  39.     GLOBAL CUIDLL$
  40.  
  41.     '' Include files
  42.     '$INCLUDE 'setupapi.inc'
  43.     
  44.     '' Custom UI dll
  45.     CUIDLL$ = "mscuistf.dll"
  46.     
  47.     '' Dialog ID's
  48.     CONST DESTPATH      = 1000
  49.     CONST APPHELP       = 2000
  50.     CONST TOOBIG        = 3000
  51.     CONST BADPATH       = 4000
  52.     CONST SUCCESS       = 5000
  53.     
  54.     '' Bitmap ID
  55.     CONST LOGO = 1
  56.     
  57.     '' Functions and subroutines
  58.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  59.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  60.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  61.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  62.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  63.     DECLARE SUB ModifyViewerIni
  64.     DECLARE SUB RegisterCustomFonts
  65.     DECLARE SUB ModifyProgramManager
  66.     DECLARE SUB ShowSuccess
  67.     DECLARE SUB RegisterDrivers
  68.     
  69.     '' The following statement turns size checking off. Set it to scmOnFatal 
  70.     '' to enable size checking, where Setup will compare the disk file size 
  71.     '' with the INF file size and report an error if they are not the same.
  72.     
  73.     i% = SetSizeCheckMode(scmOff)
  74.     
  75.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  76.     '' alter the banner bitmap.
  77.     
  78.     '' Customized (7/5/95 - KWC)
  79.     SetTitle "World Wide Web Directory Setup"
  80.     SetBitmap CUIDLL$, LOGO 
  81.     
  82.     '' Read in the INF file.
  83.     
  84.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  85.     
  86.     '' Decide where to put title files
  87.     IF PromptForPath% = 1 THEN
  88.         szTitleDir$ = GetTitleDir(DefaultPath$)
  89.         IF szTitleDir$ = "" THEN
  90.             GOTO QUIT
  91.         ENDIF
  92.     ELSE
  93.         szTitleDir$ = GetWindowsDir()
  94.     ENDIF   
  95.  
  96.     '' Change default path to actual path 1/21/95-KDH
  97.     DefaultPath$ = szTitleDir$
  98.     
  99.     '' Copy files
  100.     IF CopyFiles(szTitleDir$) = 0 THEN
  101.         GOTO QUIT
  102.     ENDIF
  103.  
  104.     '' Create the MVIEWER2.EXE MVB association 
  105.     CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone
  106.  
  107.     '' Register in VIEWER.INI
  108.     ModifyViewerIni
  109.  
  110.     '' Register custom fonts
  111.     RegisterCustomFonts
  112.  
  113.     '' Register drivers
  114.     RegisterDrivers
  115.     
  116.     '' Modify Program Manager
  117.     ModifyProgramManager    
  118.     
  119.     '' Success dialog
  120.     ShowSuccess
  121.     
  122. QUIT:
  123.     
  124.     END
  125.     
  126.  
  127. '*************************************************************************
  128. '** Purpose:
  129. '**     Prompts the user for a path for the title files
  130. '** Arguments:
  131. '**     szDefault$ - default path
  132. '** Returns:
  133. '**     New valid path name, or "" if the user quit.
  134. '*************************************************************************
  135.  
  136. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  137.  
  138.     SetSymbolValue "String", TitleShortName$
  139.     SetSymbolValue "EditTextIn", szDefault$
  140.     SetSymbolValue "EditFocus", "ALL"
  141.  
  142.     GETPATH:
  143.  
  144.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  145.  
  146.     IF sz$ = "CONTINUE" THEN
  147.         szTitleDir$ = GetSymbolValue("EditTextOut")
  148.         IF IsDirWritable(szTitleDir$) = 0 THEN
  149.  
  150.             BADPATH:
  151.  
  152.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  153.             IF sz$ = "REACTIVATE" THEN
  154.                 GOTO BADPATH
  155.             END IF
  156.             UIPop 1
  157.             GOTO GETPATH
  158.         END IF
  159.         UIPop 1
  160.         CreateDir szTitleDir$, cmoNone
  161.  
  162.     ELSEIF sz$ = "REACTIVATE" THEN
  163.         GOTO GETPATH
  164.  
  165.     ELSE
  166.         szTitleDir$ = ""
  167.  
  168.     END IF
  169.  
  170.     GetTitleDir = szTitleDir$
  171.  
  172. END FUNCTION
  173.  
  174.  
  175. '*************************************************************************
  176. '** Purpose:
  177. '**     Copies the files in the INF file
  178. '** Arguments:
  179. '**     szTitleDir$ - destination directory for the title files
  180. '** Returns
  181. '**     1 if files were copied, 0 otherwise
  182. '*************************************************************************
  183.  
  184. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  185.  
  186.     '' Add all system files to the copy list
  187.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  188.     
  189.     '' Add all of the title files to the copy list
  190.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  191.     
  192.     '' Check size
  193.     szExtras$ = "Extra"
  194.     szCosts$ = "Costs"
  195.     szNeededs$ = "Neededs"
  196.     FOR i% = 1 TO 26 STEP 1
  197.         AddListItem szExtras$, "0"
  198.     NEXT i%
  199.     
  200.     '' We assume that VIEWER.INI will take another 4K (SYMTAB11.C Correction applied 1/15/95 - KDH)
  201.     ReplaceListItem szExtras$, ASC(MID$(UCASE$(GetWindowsDir()), 1, 1)) - ASC("A") + 1, STR$(4096)
  202.     
  203.     '' Get amount of space required
  204.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  205.     
  206.     '' Put up a message if there is not enough space
  207.     FOR i% = 1 TO 26 STEP 1
  208.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  209.     
  210.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  211.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  212.     
  213.             TOOBIG:
  214.     
  215.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  216.             IF sz$ = "REACTIVATE" THEN
  217.                 GOTO TOOBIG
  218.             END IF
  219.             UIPop 1
  220.             CopyFiles = 0
  221.             GOTO DONTCOPY
  222.         END IF
  223.     NEXT i%
  224.     
  225.     '' Copy the files
  226.     CopyFilesInCopyList
  227.     
  228.     CopyFiles = 1
  229.  
  230. DONTCOPY:
  231.  
  232. END FUNCTION
  233.  
  234.  
  235. '*************************************************************************
  236. '** Purpose:
  237. '**     Puts up a success dialog
  238. '*************************************************************************
  239.  
  240. SUB ShowSuccess STATIC
  241.  
  242.     SUCCESS:
  243.     
  244.     SetSymbolValue "String1", TitleShortName$
  245.     sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
  246.     IF sz$ = "REACTIVATE" THEN
  247.         GOTO SUCCESS
  248.     END IF
  249.     UIPop 1
  250.     
  251. END SUB
  252.  
  253.  
  254. '*************************************************************************
  255. '** Purpose:
  256. '**     Appends a file name to the end of a directory path,
  257. '**     inserting a backslash character as needed.
  258. '** Arguments:
  259. '**     szDir$  - full directory path (with optional ending "\")
  260. '**     szFile$ - filename to append to directory
  261. '** Returns:
  262. '**     Resulting fully qualified path name.
  263. '*************************************************************************
  264.  
  265. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  266.     IF szDir$ = "" THEN
  267.         MakePath = szFile$
  268.     ELSEIF szFile$ = "" THEN
  269.         MakePath = szDir$
  270.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  271.         MakePath = szDir$ + szFile$
  272.     ELSE
  273.         MakePath = szDir$ + "\" + szFile$
  274.     END IF
  275. END FUNCTION
  276.  
  277.  
  278. '*************************************************************************
  279. '** Purpose:
  280. '**     Registers a font.
  281. '** Arguments:
  282. '**     fontfile$ - font filename
  283. '**     fontname$ - font name.
  284. '*************************************************************************
  285.  
  286. SUB RegisterFont(fontfile$, fontname$) STATIC
  287.  
  288.     '' A simple error catching wrapper around AddFont, which is a 'C' routine in MSCUISTF.DLL
  289.  
  290.     IF AddFont(fontfile$, fontname$) = -1 THEN
  291.         j% = DoMsgBox("Could not install " + fontfile$ + " font.", "Viewer Font Installation", 0)
  292.     ENDIF
  293.  
  294. END SUB
  295.  
  296.  
  297. '*************************************************************************
  298. '** Purpose:
  299. '**     Registers title in VIEWER.INI
  300. '*************************************************************************
  301.  
  302. SUB ModifyViewerIni STATIC
  303.  
  304.     '' Get the VIEWER.INI file
  305.     
  306.     szIni$ = MakePath(GetWindowsDir(), "VIEWER.INI")
  307.  
  308.     '' First register the title file, setting the Name and Path entries. 
  309.     '' We assume that the MVB file is the same directory as SETUP.EXE.
  310.     ''
  311.     '' CUSTOMIZATION: If you're installing multiple MVB files, copy the
  312.     '' following two statements for each additional file, substituting
  313.     '' the appropriate long name and MVB filename for the TitleLongName$
  314.     '' and MVBFileName$ variables.
  315.     
  316.     CreateIniKeyValue szIni$, MVBFileName$, "Name", TitleLongName$, cmoOverwrite
  317.     CreateIniKeyValue szIni$, MVBFileName$, "Path", GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  318.     
  319.     '' Now we have to register the MVB file in the [FILES] section, so 
  320.     '' Viewer can find files that are not on the path and display a 
  321.     '' special message when a file is not found.
  322.  
  323.     CreateIniKeyValue szIni$, "FILES", MVBFileName$ + ".MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the " + TitleLongName$ + " disk.", cmoOverwrite
  324.  
  325.     '' CUSTOMIZATION: If you're installing a Help title or any custom DLLs,
  326.     '' you should copy the preceding statement for each extra title or DLL.
  327.     ''
  328.     '' Example for installing an extra title:
  329.     ''
  330.     ''    CreateIniKeyValue szIni$, "FILES", "GALHELP.MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the Viewer 2.0 Gallery disk.", cmoOverwrite
  331.     ''
  332.     '' Example for installing a custom DLL:
  333.     ''
  334.     ''    CreateIniKeyValue szIni$, "FILES", "GALLERY.DLL", GetSymbolValue("STF_SRCDIR") + "," + "A required file is missing. Please reinstall the Viewer Gallery.", cmoOverwrite
  335.  
  336. END SUB
  337.  
  338.  
  339. '*************************************************************************
  340. '** Purpose:
  341. '**     Creates program manager entries for the title
  342. '*************************************************************************
  343.  
  344. SUB ModifyProgramManager STATIC
  345.  
  346.     '' Create the program manager group
  347.  
  348.     CreateProgmanGroup ProgmanGroup$, "", cmoNone
  349.     ShowProgmanGroup ProgmanGroup$, 1, cmoNone
  350.     
  351.     '' Create an entry for the title
  352.     '' Modified to use custom icon 1/19/95-KDH
  353.     CreateProgmanItem ProgmanGroup$, ProgmanItem$, "MVIEWER2.EXE " + MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".MVB"), MakePath(DefaultPath$, MVBFileName$ + ".ICO"), cmoOverwrite
  354.     '' Added to create item for readme file 7/08/95-KWC
  355.     CreateProgmanItem ProgmanGroup$, "Read Me!", "MVIEWER2.EXE " + MakePath(GetSymbolValue("STF_SRCDIR"), "README.MVB"), MakePath(DefaultPath$, "README.ICO"), cmoOverwrite
  356.     
  357.     '' CUSTOMIZATION: 
  358.     ''
  359.     '' To create additional Program Manager items, copy the preceding 
  360.     '' statement for each additional item, substituting the appropriate
  361.     '' name for the MVBFileName$ variable.
  362.     ''
  363.     '' To display a custom icon with the Program Manager item, specify
  364.     '' the icon filename with the fourth parameter (this parameter is 
  365.     '' currently an empty string, ""). The following example specifies 
  366.     '' an icon with the same filename as the .MVB file:
  367.     ''
  368.     ''       CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".ICO"), cmoOverwrite
  369.  
  370. END SUB
  371.  
  372.  
  373. '*************************************************************************
  374. '** Purpose:
  375. '**     Registers custom fonts with Windows.
  376. '*************************************************************************
  377.  
  378. SUB RegisterCustomFonts STATIC
  379.  
  380.     '' CUSTOMIZATION: If you install custom fonts, then add statements
  381.     '' in this routine to register the fonts with the current Windows 
  382.     '' session and to add them to the WIN.INI [Fonts] section. 
  383.     ''
  384.     '' Note that TrueType fonts can only be installed in Windows 3.1.
  385.     '' RegisterFont automatically creates the required .FOT file for 
  386.     '' TrueType fonts.
  387.     ''    
  388.     '' The following example registers a font residing in MISTRAL.TTF
  389.     '' and installs the font with the name Mistral (True Type):
  390.     '' 
  391.     ''     RegisterFont "mistral.ttf", "Mistral (TrueType)"
  392.     ''
  393.  
  394. END SUB
  395.  
  396.  
  397. '*************************************************************************
  398. '** Purpose:
  399. '**     Registers Windows drivers
  400. '*************************************************************************
  401.  
  402. SUB RegisterDrivers STATIC
  403.  
  404. '' CUSTOMIZATION: Video for Windows is not a standard component of
  405. '' Windows 3.1. If your title uses video, proceed as follows.
  406. ''
  407. '' 1) Add the following files to the [System Files] section of the INF file:
  408. ''
  409. ''    dispdib.dll
  410. ''    msvideo.dll
  411. ''    indeo.drv
  412. ''    mciavi.drv
  413. ''    msvidc.drv
  414. ''
  415. '' 2) Add the above files to your release directory. US versions can be 
  416. ''    found in the \SYSTEM subdirectory of your Viewer disc. French and
  417. ''    German versions were not available at ship time. Please contact 
  418. ''    Microsoft or check the Multimedia Viewer section on the Microsoft
  419. ''    Compuserve Forum for further details.
  420. ''
  421. '' 3) Uncomment the following lines: 
  422. ''
  423. ''CreateIniKeyValue "WIN.INI", "mci extensions", "AVI", "AVIVIDEO", cmoNone
  424. ''CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "mci", "AVIVIDEO", "MCIAVI.DRV", cmoNone
  425. ''CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.msvc", "msvidc.drv", cmoNone
  426. ''CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.rt21", "indeo.drv", cmoNone
  427.  
  428. END SUB
  429.  
  430.  
  431.  
  432.