home *** CD-ROM | disk | FTP | other *** search
/ My First Incredible Amazing Dictionary / DKMMMFD.iso / dksetup / dksetup.mst < prev    next >
Text File  |  1995-05-02  |  11KB  |  356 lines

  1. ''$DEFINE DEBUG
  2. '$INCLUDE 'dkgen.inc'
  3.  
  4. ' Paths and INI stuff
  5. CONST APPLICATION_INI_FILE = "mfd.ini"
  6. CONST APPLICATION_EXE_FILE = "mfd.exe"
  7. CONST APPLICATION_EXE2_FILE = "sampler2.exe"
  8. CONST APPLICATION_MENU_FILE = "custmenu.exe"
  9. CONST APPLICATION_PENGE_FILE = "mfd.png"
  10.  
  11. CONST INI_FILE_SOURCE = "WinPath" ' OR "AppPath"
  12.  
  13. ' Language dependant strings
  14. CONST APPLICATION_README_FILE = "readme.txt"
  15. CONST APPLICATION_README_FILE2 = "readme2.txt"
  16. CONST STR_README = "MFIAD Read Me"
  17. CONST STR_MSGCAPTION = "My First Incredible Amazing Dictionary Setup"
  18.  
  19. CONST STR_PRODUCTNAME = "My First Incredible Amazing Dictionary"
  20. CONST DEFAULT_INSTALL_PATH = "\DKMM\MFIAD"
  21.  
  22. CONST SAMPLER_PATH = "SAMPLER"
  23.  
  24. 'prod + sampler string
  25. CONST STR_CHOICEERR = "You must choose to install either My First Incrediable Amazing Dictionary or the Sampler if you wish to continue."
  26.  
  27.  
  28. DECLARE SUB Install()
  29. DECLARE SUB AddFilesToCopyList(szInstallType$)
  30.  
  31. DECLARE FUNCTION IsCDROMDrive LIB "dkutils.dll" (wDrive%) As INTEGER
  32.  
  33.  
  34. Init:
  35.    Initialise STR_PRODUCTNAME, DEFAULT_INSTALL_PATH, STR_MSGCAPTION
  36.  
  37.  
  38. WelcomeDlg:
  39.     if Welcome() = NAV_BACK then
  40.         ' Don nothing - cant go back
  41.     end if
  42.  
  43.     if TestSystem() = NAV_BACK then
  44.         goto WelcomeDlg
  45.     end if
  46.  
  47.  
  48. ExpressCustomDlg:
  49.     ' defaults to Express
  50.     'if szExpressCustomChoice = "EXPRESS" then
  51.     '    SetSymbolValue "RadioDefault", "1"
  52.     'else
  53.     '    SetSymbolValue "RadioDefault", "1"
  54.     'end if
  55.  
  56. ECDlgLoop:
  57.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_SPEED, "FRadioDlgProc", IDD_WHIZZHELP, PROC_HELP)
  58.  
  59.     select case szButton
  60.     case "REACTIVATE"
  61.         goto ECDlgLoop
  62.     case "BACK"
  63.         UIPop 1
  64.         goto WelcomeDlg
  65.     case "CONTINUE" ' Install
  66.         UIPop 1
  67.         if GetSymbolValue("ButtonChecked") = "1" then
  68.             szExpressCustomChoice = "EXPRESS"
  69.             goto ExpressInstallLoop
  70.         else
  71.             szExpressCustomChoice = "CUSTOM"
  72.             goto CustomInstallLoop
  73.         end if
  74.     case "EXIT"
  75.         AskQuit
  76.         goto ECDlgLoop
  77.     end select
  78.  
  79.  
  80. CustomInstallLoop:
  81. GetPathDlg:
  82.     SetSymbolValue "EditTextIn", szDestPath
  83.     szOldDestPath = szDestPath
  84.     SetSymbolValue "EditFocus", "ALL"
  85.  
  86. GetPathDlgLoop:
  87.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_DESTPATH, "FEditDlgProc", IDD_PATHHELP, PROC_HELP)
  88.  
  89.     select case szButton
  90.     case "REACTIVATE"
  91.         goto GetPathDlgLoop
  92.  
  93.     case "BACK"
  94.         UIPop 1
  95.         szDestPath = szOldDestPath
  96.         goto ECDlgLoop
  97.  
  98.     case "CONTINUE"
  99.         UIPop 1
  100.         szDestPath = GetSymbolValue("EditTextOut")
  101.  
  102.         if mid$(szDestPath, 2, 1) = ":" and mid$(szDestPath, 3, 1) <> "\" then
  103.             szTemp$ = mid$(szDestPath, 1, 2) + "\" + mid$(szDestPath, 3, len(szDestPath)-2)
  104.             szDestPath = szTemp
  105.         end if
  106.  
  107.         if mid$(szDestPath, 2, 1) <> ":" then
  108.             if mid$(szDestPath, 1,1) <> "\" then
  109.                 szDestPath = mid$(szWinPath, 1,1) + ":\" + szDestPath
  110.             else
  111.                 szDestPath = mid$(szWinPath, 1,1) + ":" + szDestPath
  112.             end if
  113.         elseif IsDriveValid(mid$(szDestPath, 1,1)) = 0 then
  114.             szDestPath = szOldDestPath
  115.             UIPop 1
  116.             BadPath
  117.             goto GetPathDlg
  118.         end if
  119.  
  120.         ' check for "foreign" chars in path
  121.         slength% = len(szDestPath)
  122.         found% = 0
  123.         for i% = 1 to slength%
  124.             if asc(mid$(szDestPath, i%, 1)) > 126 then
  125.                 found% = 1
  126.             end if
  127.         next i%
  128.         if found% = 1 then
  129.             szDestPath = szOldDestPath
  130.             UIPop 1
  131.             BadPath
  132.             goto GetPathDlg
  133.         end if
  134.  
  135.         wDrive% = asc(mid$(szDestPath, 1,1)) - asc("A")
  136.         if IsCDROMDrive(wDrive%) > 0 then
  137.             szDestPath = szOldDestPath
  138.             UIPop 1
  139.             BadPath
  140.             goto GetPathDlg
  141.         end if
  142.  
  143.         if IsDriveNetwork(mid$(szDestPath,1,1)) = 1 then
  144.             szDestPath = szOldDestPath
  145.             UIPop 1
  146.             NetworkDrive
  147.             goto GetPathDlg
  148.         end if
  149.  
  150.         if IsDirWritable(szDestPath) = 0 then
  151.             szDestPath = szOldDestPath
  152.             UIPop 1
  153.             BadPath
  154.             goto GetPathDlg
  155.         end if
  156.  
  157.         if DoesDirExist(szDestPath) = 0 then
  158.             dButton = DoMsgBox( STR_DIRNOTEXIST, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  159.             if dButton = 7 then
  160.                 goto GetPathDlg
  161.             end if
  162.         end if
  163.         UIPop 1
  164.  
  165.  
  166.     case "EXIT"
  167.         AskQuit
  168.         goto GetPathDlg
  169.     end select
  170.  
  171. GetCustomChoicesDlg:
  172.     SetSymbolValue "CheckItemsState", ""
  173.     AddListItem "CheckItemsState", szMinimalInstall
  174.     AddListItem "CheckItemsState", szAddPMItem
  175. GetCustomChoicesLoop:
  176.  
  177.     ClearCopyList
  178.     if szMinimalInstall = "OFF" then
  179.         AddFilesToCopyList "FULL"
  180.     else
  181.         AddFilesToCopyList "MINIMAL"
  182.     end if
  183.  
  184.     dDestDrive = asc(mid$(szDestPath, 1,1)) - asc("A")+1
  185.     dWinDrive = asc(mid$(szWinPath, 1,1)) - asc("A")+1
  186.  
  187.     SetSymbolValue "DriveStatusText", ""
  188.     AddListItem "DriveStatusText", mid$(szDestPath, 1,1) + ":"
  189.     AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dDestDrive) / 1024) + " K"
  190.     AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szDestPath, 1,1))/1024) + " K"
  191.  
  192.     if dDestDrive = dWinDrive then
  193.         AddListItem "DriveStatusText", ""
  194.         AddListItem "DriveStatusText", ""
  195.         AddListItem "DriveStatusText", ""
  196.     else
  197.         AddListItem "DriveStatusText", mid$(szWinPath, 1,1) + ":"
  198.         AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dWinDrive)/ 1024 ) + " K"
  199.         AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szWinPath, 1,1))/1024) + " K"
  200.     end if
  201.  
  202.     AddListItem "DriveStatusText", szDestPath
  203.  
  204. ChooseInstall:
  205.  
  206.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_CUSTOM, "FCustInstDlgProc", IDD_CUSTOMHELP, PROC_HELP)
  207.  
  208.     szMinimalInstall = GetListItem("CheckItemsState", 1)
  209.     szAddPMItem = GetListItem("CheckItemsState", 2)
  210.  
  211.     select case szButton
  212.     case "REACTIVATE"
  213.         goto GetCustomChoicesLoop
  214.     case "BACK"
  215.         UIPop 1
  216.         goto GetPathDlg
  217.     case "CONTINUE"
  218.         UIPop 1
  219.     case "EXIT"
  220.         AskQuit
  221.         goto GetCustomChoicesLoop
  222.     end select
  223.  
  224.     ClearCopyList
  225.     if szMinimalInstall = "OFF" then
  226.         AddFilesToCopyList "FULL"
  227.     else
  228.         AddFilesToCopyList "MINIMAL"
  229.     end if
  230.     goto CommonInstallLoop
  231.  
  232. ExpressInstallLoop:
  233.     AddFilesToCopyList "FULL"
  234.     goto CommonInstallLoop
  235.  
  236. CommonInstallLoop:
  237.     InitCommonInstall
  238.  
  239.     if szMinimalInstall = "ON" and GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < MINIMUM_DISK_SPACE then
  240.         error ERR_NODISKSPACE
  241.     elseif GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < GetDiskSpaceNeeded( asc(mid$(szDestPath, 1,1))-asc("A")+1 ) then
  242.         error ERR_NODISKSPACE
  243.     end if
  244.  
  245.     UpdateIndeoAVIDrivers
  246.  
  247.     Install
  248.  
  249.     CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  250.     ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  251.     szReadmeTitle$ = STR_PRODUCTNAME + " " + STR_README
  252.  
  253.     szSamplerPath$ = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), SAMPLER_PATH)
  254.     szSamplerPath$ = MakePath(szSamplerPath$, APPLICATION_EXE2_FILE)
  255.  
  256.     if szMinimalInstall = "ON" then
  257.         szInf$ = MakePath(szSrcBinPath, APPLICATION_MENU_FILE) + " " + MakePath(szSrcBinPath, APPLICATION_EXE_FILE) + " " + MakePath(szSrcBinPath, APPLICATION_PENGE_FILE) + " " + szSamplerPath$
  258.         CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  259.         CreateProgmanItem STR_COMPANYNAME, STR_README, "notepad.exe " + MakePath(szSrcBinPath, APPLICATION_README_FILE), "", cmoOverwrite
  260.     else
  261.         szInf$ = MakePath(szDestPath, APPLICATION_MENU_FILE) + " " + MakePath(szDestPath, APPLICATION_EXE_FILE) + " " + MakePath(szDestPath, APPLICATION_PENGE_FILE) + " " + szSamplerPath$
  262.         CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  263.         CreateProgmanItem STR_COMPANYNAME, STR_README, "notepad.exe " + MakePath(szDestPath, APPLICATION_README_FILE), "", cmoOverwrite
  264.     end if
  265.  
  266. '$IFDEF DEBUG
  267.     DumpCopyList MakePath(szDestPath, "copylist.txt")
  268. '$ENDIF ''DEBUG
  269.  
  270.     EndCommonInstall APPLICATION_README_FILE, 0
  271.  
  272. quit:
  273.     on error goto quit
  274.  
  275.     select case ERR
  276.  
  277.     case 0
  278.         hDlg = IDD_EXITSUCCESS
  279.     case STFQUIT
  280.         hDlg = IDD_EXITQUIT
  281.     case ERR_NODISKSPACE
  282.         hDlg = IDD_NODISKSPACE
  283.     case else
  284.         hDlg = IDD_EXITFAILURE
  285.     end select
  286.  
  287.     UIPop 10
  288. quit2:
  289.     szButton = UIStartDlg(CUIDLL_FILENAME, hDlg, "FInfo0DlgProc", 0, "")
  290.     select case szButton
  291.     case "REACTIVATE"
  292.         goto quit2
  293.     end select
  294.  
  295.     UIPop 1
  296.     DeInitialise
  297.     stop
  298.     end
  299.  
  300. quitError:
  301.     dButton = DoMsgBox (STR_QUITERROR, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  302.     DeInitialise
  303.     stop
  304.     end
  305.  
  306.  
  307.  
  308.  
  309. Sub Install() STATIC
  310.  
  311.     cursor% = ShowWaitCursor()
  312.     CreateDir szDestPath, cmoNone
  313.     SetRestartDir szDestPath
  314.     RestoreCursor(cursor%)
  315.  
  316.     CopyFilesInCopyList
  317.  
  318.     Run ("regedit.exe /s " + MakePath(szWinPath, "mplayer.reg"))
  319.     Run ("regedit.exe /s " + MakePath(szWinSysPath, "OLE2.reg"))
  320.     Run ("regedit.exe /s " + MakePath(szWinSysPath, "cleanup.reg"))
  321.     Run ("profdisp.exe")
  322.  
  323.     if INI_FILE_SOURCE = "AppPath" then
  324.         szAppINIPath = MakePath(szDestPath, APPLICATION_INI_FILE)
  325.     else
  326.         szAppINIPath = MakePath(szWinPath, APPLICATION_INI_FILE)
  327.     end if
  328.  
  329.     szPengePath = mid$(szSrcSetupPath, 1,len(szSrcSetupPath)-len(SOURCE_SETUP_SUBDIR)-2) ' -2 removes backslash
  330.     CreateIniKeyValue szAppINIPath, PRODUCT_INI_DIR_SECTION_NAME, PRODUCT_INI_DIR_ENTRY_NAME, szPengePath, cmoOverwrite
  331. End Sub
  332.  
  333.  
  334. Sub AddFilesToCopyList(szInstallType$) STATIC
  335.     cursor% = ShowWaitCursor()
  336.  
  337.     select case szInstallType
  338.     case "FULL"
  339.         AddSectionFilesToCopyList SETUP_INI_BINARIES_SECTION_NAME, szSrcBinPath, szDestPath
  340.  
  341.     case "MINIMAL"
  342.         ' nothing
  343.     end select
  344.  
  345. '    if fSystemUpdated = 1 then
  346.         AddSectionFilesToCopyList "VfW Runtime", szSrcBinPath, szWinSysPath
  347.         AddSectionFilesToCopyList "OLE2", szSrcBinPath, szWinSysPath
  348.         AddSectionFilesToCopyList "ACM Drivers", szSrcBinPath, szWinSysPath
  349.         AddSectionFilesToCopyList "MPlayer", szSrcBinPath, szWinPath
  350.         AddSectionFilesToCopyList "AVICodecs", szSrcBinPath, szWinSysPath
  351. '    end if
  352.     RestoreCursor(cursor%)
  353. End Sub
  354.  
  355.  
  356.