home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / lw50b1.exe / SETUP.MST < prev    next >
Text File  |  1995-09-06  |  14KB  |  376 lines

  1. '**************************************************************************
  2. '*                              Netscape Setup
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST WELCOME       = 100
  12. CONST ASKQUIT       = 200
  13. CONST PROGROUP      = 260
  14. CONST DESTPATH      = 300
  15. CONST EXITFAILURE   = 400
  16. CONST EXITQUIT      = 600
  17. CONST EXITSUCCESS   = 700
  18. CONST OPTIONS       = 800
  19. CONST APPHELP       = 900
  20. CONST BADPATH       = 6400
  21.  
  22. ''Bitmap ID
  23. CONST LOGO = 1
  24.  
  25. GLOBAL DEST$        ''Default destination directory.
  26.  
  27. CONST SW_MINIMIZE   = 6
  28. CONST SW_RESTORE    = 9
  29. CONST SW_SHOW       = 5
  30.  
  31. CONST IDYES         = 6
  32.  
  33. DECLARE FUNCTION FindWindow LIB "user" (szClassName$, szWindow$) AS INTEGER
  34. DECLARE SUB      ShowWindow LIB "user" (hwnd%, nCmdShow%)
  35. DECLARE SUB      WinExec LIB "kernel" (szCmdLine$, nCmdShow%)
  36.  
  37. DECLARE SUB      UpdateNetscapeIni LIB "mscuistf.dll" (szIniPath$)
  38.  
  39. DECLARE FUNCTION IsBadWin32s LIB "mscuistf.dll" () AS INTEGER
  40.  
  41. DECLARE SUB      Install
  42. DECLARE SUB      CreateNewsDir (szNetscapeIni$, szNewsDir$)
  43. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  44.  
  45. INIT:
  46.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  47.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  48.  
  49.     SetBitmap CUIDLL$, LOGO
  50.     SetTitle "Netscape Setup For LAN WorkPlace 5"
  51.  
  52.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  53.     IF szInf$ = "" THEN
  54.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  55.     END IF
  56.     ReadInfFile szInf$
  57.  
  58.     ' See if the user is running a version of Win32s less than 1.2
  59.     IF IsBadWin32s() THEN
  60.         szErrText$ = "Version 1.1 of the Netscape Navigator uses OLE 2.02, which is not compatible with this version of Win32s."
  61.         szErrText$ = szErrText + " You must upgrade to Win32s version 1.2 before installing the Netscape Navigator."
  62.         szErrText$ = szErrText + "\nFor more information, please read the Netscape Navigator README file, LW50B1.TXT."
  63.         i% = DoMsgBox(szErrText$, "Netscape Setup", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  64.         END
  65.     END IF
  66.  
  67.     ' If there is an existing Netscape installation then use the current
  68.     ' directory as the default location; otherwise use \NETSCAPE
  69.     ' BAS : 7/25/95 - This section was modified for LAN WorkPlace
  70.     '   It will check the LWP.INI file in the WINDOWS directory,
  71.     '  and get the path of the LWP tree, it then creates a path 
  72.     ' <DRIVE><LWP PATH>"\Browser", representing the default place
  73.     ' to store Netscape. It if cannot get this string from the file,
  74.     ' it will show the "\NETSCAPE" string instead.
  75. '    DEST$ = GetIniKeyString("WIN.INI", "Netscape", "ini")
  76. '    IF DEST$ = "" THEN
  77.         TEMP$ = MID$(GetWindowsDir, 1, 1) + ":\WINDOWS\LWP.INI"
  78.         DEST$ = GetIniKeyString(TEMP$, "Paths", "LWP_CFG")
  79.         IF DEST$ = "" THEN
  80.              DEST$ = MID$(GetWindowsDir, 1, 1) + ":\NET\BROWSER"
  81.         ELSE
  82.              SPLITPATH DEST$, drv$, dir$, filename$, ext$
  83.              DEST$ = drv$ + MID$(dir$, 1, LEN(dir$) - 1) + "\BROWSER"
  84.         END IF
  85. '    ELSE
  86. '        SPLITPATH DEST$, drv$, dir$, filename$, ext$
  87. '        DEST$ = drv$ + MID$(dir$, 1, LEN(dir$) - 1)
  88. '    END IF
  89.  
  90. WELCOME:
  91.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  92.     IF sz$ = "CONTINUE" THEN
  93.         UIPop 1
  94.     ELSE
  95.         GOSUB ASKQUIT
  96.         GOTO WELCOME
  97.     END IF
  98.  
  99. GETPATH:
  100.     SetSymbolValue "EditTextIn", DEST$
  101. GETPATHL1:
  102.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FGetPathDlgProc", APPHELP, HELPPROC$)
  103.     DEST$ = GetSymbolValue("EditTextOut")
  104.  
  105.     IF sz$ = "CONTINUE" THEN
  106.         IF IsDirWritable(DEST$) = 0 THEN
  107.             GOSUB BADPATH
  108.             GOTO GETPATHL1
  109.         END IF
  110.         UIPop 1
  111.     ELSEIF sz$ = "REACTIVATE" THEN
  112.         GOTO GETPATHL1
  113.     ELSE
  114.         GOSUB ASKQUIT
  115.         GOTO GETPATH
  116.     END IF
  117.  
  118. CHOOSEGROUP:
  119.     SetSymbolValue "ProgramGroup", "Netscape"
  120. CHOOSEGROUP1:
  121.     sz$ = UIStartDlg(CUIDLL$, PROGROUP, "FProgramGroupDlgProc", APPHELP, HELPPROC$)
  122.  
  123.     IF sz$ = "CONTINUE" THEN
  124.         UIPop 1
  125.     ELSEIF sz$ = "REACTIVATE" THEN
  126.         GOTO CHOOSEGROUP1
  127.     ELSE
  128.         GOSUB ASKQUIT
  129.         GOTO CHOOSEGROUP1
  130.     END IF
  131.  
  132.     Install
  133.  
  134. QUIT:
  135.     ON ERROR GOTO ERRQUIT
  136.  
  137.     IF ERR = 0 THEN
  138.         IF DoMsgBox("Installation is complete. Would you like to read the README file now?", "Netscape Setup", MB_YESNO) = IDYES THEN
  139.             WinExec "NOTEPAD " + MakePath(DEST$, "LW50B1.TXT"), SW_SHOW
  140.         END IF
  141.         END
  142.     ELSEIF ERR = STFQUIT THEN
  143.         dlg% = EXITQUIT
  144.     ELSE
  145.         dlg% = EXITFAILURE
  146.     END IF
  147. QUITL1:
  148.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  149.     IF sz$ = "REACTIVATE" THEN
  150.         GOTO QUITL1
  151.     END IF
  152.     UIPop 1
  153.  
  154.     END
  155.  
  156. ERRQUIT:
  157.     i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  158.     END
  159.  
  160. BADPATH:
  161.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  162.     IF sz$ = "REACTIVATE" THEN
  163.         GOTO BADPATH
  164.     END IF
  165.     UIPop 1
  166.     RETURN
  167.  
  168. ASKQUIT:
  169.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  170.  
  171.     IF sz$ = "EXIT" THEN
  172.         UIPopAll
  173.         ERROR STFQUIT
  174.     ELSEIF sz$ = "REACTIVATE" THEN
  175.         GOTO ASKQUIT
  176.     ELSE
  177.         UIPop 1
  178.     END IF
  179.     RETURN
  180.  
  181. '**
  182. '** Purpose:
  183. '**     Creates specified news directory
  184. '** Arguments:
  185. '**     Path to Netscape INI file and directory to create.
  186. '** Returns:
  187. '**     none.
  188. '*************************************************************************
  189. SUB CreateNewsDir (szNetscapeIni$, szNewsDir$) STATIC
  190.     ' Check for a file with the same name as the directory we are trying to create
  191.     IF DoesFileExist(szNewsDir$, femExists) THEN
  192.         ' Try using MOZNEWS as the directory name
  193.         IF DoesFileExist(MakePath(DEST$, "MOZNEWS"), fmExists) = 0 THEN
  194.             CreateDir MakePath(DEST$, "MOZNEWS"), cmoNone
  195.  
  196.             ' Add a line to the Netscape INI file pointing to the news directory
  197.             CreateIniKeyValue szNetscapeIni$, "News", "News Directory", MakePath(DEST$, "MOZNEWS"), cmoOverwrite
  198.         END IF
  199.     ELSE
  200.         CreateDir szNewsDir$, cmoNone
  201.  
  202.         ' Add a line to the Netscape INI file pointing to the news directory
  203.         CreateIniKeyValue szNetscapeIni$, "News", "News Directory", szNewsDir$, cmoOverwrite
  204.     END IF
  205. END SUB
  206.  
  207. '**
  208. '** Purpose:
  209. '**     Builds the copy list and performs all installation operations.
  210. '** Arguments:
  211. '**     none.
  212. '** Returns:
  213. '**     none.
  214. '*************************************************************************
  215. SUB Install STATIC
  216.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  217.     ' Create user specified directory and CACHE sub-directory
  218.     CreateDir DEST$, cmoNone
  219.     CreateDir MakePath(DEST$, "CACHE"), cmoNone
  220.  
  221.     AddSectionFilesToCopyList "Files", SrcDir$, DEST$
  222.  
  223.     ' Files needed for LWP 5 local WEB pages
  224.         IF DoMsgBox("Do you want to copy the LAN WorkPlace 5 Web Pages?", "Netscape Setup", MB_YESNO) = IDYES THEN
  225.             AddSectionFilesToCopyList "Web", SrcDir$, DEST$
  226.         END IF
  227.  
  228.     ' Files needed for OLE2 go in the Windows SYSTEM directory
  229.     AddSectionFilesToCopyList "OLE2", SrcDir$, GetWindowsSysDir
  230.  
  231.     ' If there is an existing NETSCAPE.INI file then ask the user if they
  232.     ' want to overwrite the existing file
  233.     IF DoesFileExist(MakePath(DEST$, "NETSCAPE.INI"), femExists) THEN
  234. '        IF DoMsgBox("Do you want to overwrite the existing NETSCAPE.INI file?", "Netscape Setup", MB_YESNO) = IDYES THEN
  235. '           AddSectionFilesToCopyList "INI", SrcDir$, DEST$
  236. '        END IF
  237.         AddSectionFilesToCopyList "INI", SrcDir$, DEST$
  238.         szOldNetsIni$ = MakePath(DEST$, "NETSCAPE.001")
  239.         sz2ndNetsIni$ = MakePath(DEST$, "NETSCAPE.INI")
  240.         CopyFile sz2ndNetsIni$, szOldNetsIni$ , cmoOverwrite, fAppend0
  241.     ELSE
  242.         AddSectionFilesToCopyList "INI", SrcDir$, DEST$
  243.         ' Read old netscape.ini file , 
  244.         szOldNetsIni$ = GetIniKeyString("WIN.INI", "Netscape", "ini")
  245.     END IF
  246.  
  247.     CopyFilesInCopyList
  248.  
  249.     ' Merge OLE2 registration into system registry
  250.     WinExec "REGEDIT /S OLE2.REG", SW_SHOW
  251.  
  252.  
  253.     ' Modify the win.ini file to have a [Netscape] section with a keyname-value
  254.     ' pair for the Netscape INI file location
  255.     CreateIniKeyValue "WIN.INI", "Netscape", "ini", MakePath(DEST$, "NETSCAPE.INI"), cmoOverwrite
  256.  
  257.     szNetscapeIni$ = MakePath(DEST$, "NETSCAPE.INI")
  258.  
  259.     ' If the user specified an installation location other than the default
  260.     ' location, then update the netscape.ini file accordingly
  261.     IF DEST$ <> "C:\NETSCAPE" THEN
  262.         UpdateNetscapeIni szNetscapeIni$
  263.     END IF
  264.  
  265.     ' See if there is a news directory specified in the INI file
  266.     szNewsDir$ = GetIniKeyString(szNetscapeIni$, "News", "News Directory")
  267.     IF szNewsDir$ = "" THEN
  268.         CreateNewsDir szNetscapeIni$, MakePath(DEST$, "NEWS")
  269.     ELSEIF DoesDirExist(szNewsDir$) = 0 THEN
  270.         CreateNewsDir szNetscapeIni$, szNewsDir$
  271.     END IF
  272.  
  273.     ' Check to see if the NEWSRC file specified in the NETSCAPE.INI actually exists
  274.     szNewsRC$ = GetIniKeyString(szNetscapeIni$, "Main", "News RC")
  275.     IF szNewsRC$ <> "" THEN
  276.         IF DoesFileExist(szNewsRC$, femExists) = 0 THEN
  277.             ' Make the default NEWSRC file be in the NEWS sub-directory
  278.             CreateIniKeyValue szNetscapeIni$, "Main", "News RC", MakePath(DEST$, "NEWS\NEWSRC"), cmoOverwrite
  279.         END IF
  280.     END IF
  281.  
  282.     ' Setup Netscape to use the audio player as an external viewer
  283.     CreateIniKeyValue szNetscapeIni$, "Viewers", "audio/basic", MakePath(DEST$, "NAPLAYER.EXE"), cmoOverwrite
  284.     CreateIniKeyValue szNetscapeIni$, "Viewers", "audio/x-aiff", MakePath(DEST$, "NAPLAYER.EXE"), cmoOverwrite
  285.     CreateIniKeyValue szNetscapeIni$, "Suffixes", "audio/basic", "au,snd", cmoOverwrite
  286.     CreateIniKeyValue szNetscapeIni$, "Suffixes", "audio/x-aiff", "aif,aiff,aifc", cmoOverwrite
  287.  
  288.     ' Make sure that the user doesn't have a home page containing mcom.com
  289.     szHomePage$ = GetIniKeyString(szNetscapeIni$, "Main", "Home Page")
  290.     IF InStr(LCase$(szHomePage$), "mcom.com") THEN
  291.     ' IF szHomePage$ = "http://home.mcom.com/home/welcome.html" THEN
  292.         CreateIniKeyValue szNetscapeIni$, "Main", "Home Page", "http://home.netscape.com/", cmoOverwrite
  293.     END IF
  294.  
  295.     ' If the user doesn't have an existing cookie file, then see if they have an existing
  296.     ' internetMCI cookie file and if they do make a copy of it
  297.     szCookieFile$ = GetIniKeyString(szNetscapeIni$, "Cookies", "Cookie File")
  298.     IF szCookieFile$ = "" THEN
  299.         szCookieFile$ = MakePath(DEST$, "COOKIES.TXT")
  300.     END IF
  301.     IF DoesFileExist(szCookieFile$, femExists) = 0 THEN
  302.         szInternetMCI$ = GetIniKeyString("WIN.INI", "IMCI", "ini")
  303.         IF szInternetMCI$ <> "" THEN
  304.             szMCICookie$ = GetIniKeyString(szInternetMCI$, "Cookies", "Cookie File")
  305.             IF szMCICookie$ <> "" THEN
  306.                 IF DoesFileExist(szMCICookie$, femExists) THEN
  307.                     CopyFile szMCICookie$, szCookieFile$, cmoNone, 0
  308.                 END IF
  309.             END IF
  310.         END IF
  311.     END IF
  312.  
  313.     ' update netscape.ini file
  314.     IF szOldNetsIni$ <> "" THEN
  315.         szBook$ = GetIniKeyString(szOldNetsIni$ , "Bookmark List", "File Location")
  316.         IF DoesFileExist(szBook$, femExists) THEN
  317.            CreateIniKeyValue szNetscapeIni$, "Bookmark List", "File Location", szBook$, cmoOverwrite
  318.         END IF
  319.  
  320.     ELSE
  321.         CreateIniKeyValue szNetscapeIni$, "Bookmark List", "File Location", MakePath(DEST$, "bookmark.htm"), cmoOverwrite
  322.     END IF
  323.  
  324.     ' update new netscape dir path
  325. '        szBook$ = MakePath("file:///",DEST$), cmoOverwrite
  326.         CreateIniKeyValue szNetscapeIni$, "Main", "Home Page", MakePath(DEST$, "homepage.htm"), cmoOverwrite
  327.         CreateIniKeyValue szNetscapeIni$, "Main", "Temp Directory", MakePath(DEST$, "temp"), cmoOverwrite
  328.         CreateIniKeyValue szNetscapeIni$, "Main", "News RC", MakePath(DEST$, "NEWS\NEWSRC"), cmoOverwrite
  329.  
  330.         CreateIniKeyValue szNetscapeIni$, "History", "History File", MakePath(DEST$, "netscape.hst"), cmoOverwrite
  331.  
  332.         CreateIniKeyValue szNetscapeIni$, "Cookies", "Cookie File", MakePath(DEST$, "cookies.txt"),cmoOverwrite
  333.  
  334.         CreateIniKeyValue szNetscapeIni$, "News", "News Directory", MakePath(DEST$, "NEWS"), cmoOverwrite
  335.  
  336.         CreateIniKeyValue szNetscapeIni$, "Cache", "Cache Dir", MakePath(DEST$, "cache"), cmoOverwrite
  337.  
  338.     ' Show the Program Manager
  339.     ShowWindow FindWindow("PROGMAN", NULL), SW_RESTORE
  340.  
  341.     ' Update program group and program items
  342.     Group$ = GetSymbolValue("ProgramGroup")
  343.     CreateProgmanGroup Group$, "", cmoNone
  344.     ShowProgmanGroup  Group$, 1, cmoNone
  345.     SLEEP 1
  346.     CreateProgmanItem Group$, "Netscape", MakePath(DEST$, "NETSCAPE.EXE"), "", cmoOverwrite
  347.  
  348.     ' Only add a README file icon if this is the default program group
  349.     if Group$ = "Netscape" then
  350.         CreateProgmanItem Group$, "Read Me", "notepad "+ MakePath(DEST$, "LW50B1.TXT"), "", cmoOverwrite
  351.     end if
  352.     SLEEP 1
  353. END SUB
  354.  
  355. '**
  356. '** Purpose:
  357. '**     Appends a file name to the end of a directory path,
  358. '**     inserting a backslash character as needed.
  359. '** Arguments:
  360. '**     szDir$  - full directory path (with optional ending "\")
  361. '**     szFile$ - filename to append to directory
  362. '** Returns:
  363. '**     Resulting fully qualified path name.
  364. '*************************************************************************
  365. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  366.     IF szDir$ = "" THEN
  367.         MakePath = szFile$
  368.     ELSEIF szFile$ = "" THEN
  369.         MakePath = szDir$
  370.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  371.         MakePath = szDir$ + szFile$
  372.     ELSE
  373.         MakePath = szDir$ + "\" + szFile$
  374.     END IF
  375. END FUNCTION
  376.