home *** CD-ROM | disk | FTP | other *** search
/ Knowledge Land / KNOWLEDGELA.ISO / pc / support / macsetup / samples / dcsetup.ace next >
Encoding:
Text File  |  1996-08-25  |  11.4 KB  |  309 lines

  1. // setup.ace: Macintosh setup program. Stolen shamelessly from Pyramid
  2. //  and hacked up to use on MovieMaker by Jim Winstead Jr.
  3.  
  4. Set the window title to a string from title.txt.
  5.  
  6. Set currentIniSection's fileName to "DCSETUP.INI".
  7. Set currentIniSection's sectionName to "MAIN".
  8.  
  9. Make the_product.
  10. Make the_product's debug_print. Set it to true.
  11. If currentIniSection's debug_print alphabetically equals "yes",
  12.     Set the_product's debug_print to true.
  13.  
  14. Call (a black screen) the_screen.
  15. In the_screen,
  16.     Record that this screen is faded.
  17.     Make a picture named bg of bg.cmp at 320,240 sized 640,480.
  18.     Make a picture named hack of hack.cmp at 320,240 sized 32,32.
  19.     Make a picture of cursor.cmp at 320,240.
  20.     Control it with the mouse.
  21.     Control it with the keyboard.
  22.  
  23.     When displayed,
  24.         Fade this screen to black.
  25.         Wait until the next cycle.
  26.         Fade this screen from black in 0.7 sec.
  27.         Record that this screen is not faded.
  28.  
  29. Display the_screen.
  30.  
  31. Wait until the_screen is not faded.
  32.  
  33. refer to i:\mm\build\lib\refer.ace.
  34. refer to i:\mm\build\lib\dprint.ace.
  35. refer to i:\mm\build\lib\strings.ace.
  36. refer to i:\mm\build\lib\math.ace.
  37.  
  38. Make install_qstn. Set it to a string from question.txt.
  39. Make default_name. Set it to a string from defname.txt.
  40.  
  41. Make a library named SaveLib of "SaveFile".
  42. Make a libFunction named saveFile of "SaveFile" from SaveLib.
  43. In saveFile,
  44.     Make prompt.  Set it to install_qstn.
  45.     Make defName.  Set it to default_name.
  46.     Make macPath.  Set it to a fixedString with length 255.
  47.     Make p1.  Set it to a list.  In it,
  48.         Make macPathLen.  Set it to 0.
  49.     Make macVol.  Set it to a fixedString with length 32.
  50.     Make p2.  Set it to a list.  In it,
  51.         Make macVolLen.  Set it to 0.
  52.     Make pcPath.  Set it to a fixedString with length 255.
  53.     Make p3.  Set it to a list.  In it,
  54.         Make pcPathLen.  Set it to 0.
  55. Call saveFile.
  56.  
  57. // only do all of this if the user actually chose a directory
  58. If saveFile's result != 0,
  59.  
  60.     // either wait a cycle for the screen to refresh or the program to really exit
  61.     Wait until the next cycle.
  62.  
  63.     // create new strings for the volumes and paths that don't have the padding of the fixed strings.
  64.     Make spstart.  Set it to a stringpoint before character 1 of saveFile's macVol.
  65.     Make spend.  Set it to a stringpoint after character (saveFile's p2's macVolLen) of saveFile's macVol.
  66.     Make macVol.  Set it to the string between spstart and spend.
  67.     dprint concatenation  {"macVol = ", macVol}.
  68.  
  69.     Set spstart to a stringpoint before character 1 of saveFile's macPath.
  70.     Set spend to a stringpoint after character (saveFile's p1's macPathLen) of saveFile's macPath.
  71.     Make macPath. Set it to the string between spstart and spend.
  72.     dprint concatenation  {"macPath = ", macPath}.
  73.  
  74.     Set spstart to a stringpoint before character 1 of saveFile's pcPath.
  75.     Set spend to a stringpoint after character (saveFile's p3's pcPathLen) of saveFile's pcPath.
  76.     Make pcPath. Set it to the string between spstart and spend.
  77.     dprint concatenation  {"pcPath = ", pcPath}.
  78.  
  79.     // volume name is hard-coded
  80.     Call "DC1" the_volume.
  81.  
  82. [
  83.     // make sure that the volume is mounted
  84.     // uh, it must be mounted or something strange is happening
  85.     If the volume the_volume is not mounted,
  86.         // should put up pretty graphic
  87.         While the volume the_volume is not mounted,
  88.             Print concatenation {"Please insert the volume \"", the_volume, "\"."}.
  89.             Wait for 1 second.
  90.         // should take down pretty graphic
  91. ]
  92.  
  93.     // We set these weird Mac constructs, knowing that they won't be saved to the INI.
  94.     Set CD root to volume the_volume.
  95.     Set HD root to volume macVol.
  96.  
  97.     Make hdRootPath. Set it to concatenation {"$productHDroot", pcPath, "\\"}.
  98.  
  99.     Fade the_screen's bg to 60 percent black in 0.3 sec.
  100.  
  101.     If the free disk space on $producthdroot\ < 15 * 1024 * 1024,
  102.         In the_screen,
  103.             Make a picture of diskspc.cmp at 320,240 sized 320,240.
  104.             Set it's bitmap's palette to hack's bitmap's palette.
  105.             Wait until the next cycle.
  106.  
  107.             When downClicked,
  108.                 End this program.
  109.                 Wait until the next cycle.
  110.  
  111.     In the_screen,
  112.         Make a picture named please_wait of plswait.cmp at 320,240 sized 320,240.
  113.         Set it's bitmap's palette to hack's bitmap's palette.
  114.         Wait until the next cycle.
  115.  
  116.     // we just do this so that the directory gets created (argh)
  117.     Copy file "$PRODUCTCDROOT\\SUPPORT\\CMN\\SAVE" to hdRootPath.
  118.  
  119.     // rename the directory to exactly what the user specified (lower-case and all)
  120.     Make a library named renameLib of "Rename".
  121.     Make a libFunction named rename of "Rename" from renameLib.
  122.     In rename,
  123.         Make oldPath. Set it to macPath.
  124.         Make newName. Set it to macPath.
  125.     Call rename.
  126.     // don't care if it fails.
  127.  
  128.     // copy the runner and the other mac files to the chosen directory
  129.     Append ":" to macPath.
  130.     Copy macintosh file "dc1:support:mac:Director's Chair" to concatenation {macPath, "Director's Chair"}.
  131.     Copy macintosh file "dc1:support:mac:Director's Chair User's Guide" to concatenation {macPath, "Director's Chair User's Guide"}.
  132.     Copy macintosh file "dc1:support:mac:override.res" to macPath.
  133.     Copy macintosh file "dc1:support:mac:cmdline.txt" to macPath.
  134.     Copy macintosh file "dc1:support:mac:SaveFile" to macPath.
  135.     Copy macintosh file "dc1:support:mac:OpenFile" to macPath.
  136.     Copy macintosh file "dc1:support:mac:CDSwap" to macPath.
  137.  
  138.     // copy the code
  139.     Copy file "$PRODUCTCDROOT\\SUPPORT\\CMN\\START.PAC" to hdRootPath.
  140.     Copy file "$PRODUCTCDROOT\\SUPPORT\\CMN\\START.INF" to hdRootPath.
  141.     Copy file "$PRODUCTCDROOT\\SUPPORT\\CMN\\START.DAC" to hdRootPath.
  142.     Copy file "$PRODUCTCDROOT\\SUPPORT\\CMN\\START.DNA" to hdRootPath.
  143.     Copy file "$PRODUCTCDROOT\\SUPPORT\\CMN\\START.DNF" to hdRootPath.
  144.  
  145.     // copy the place holders to make sure the save and render directories are installed
  146.     Copy file "$PRODUCTCDROOT\\SUPPORT\\CMN\\SAVE" to concatenation {hdRootPath, "SAVE\\"}.
  147.     Copy file "$PRODUCTCDROOT\\SUPPORT\\CMN\\RENDER" to concatenation {hdRootPath, "RENDER\\"}.
  148.  
  149.     In rename,
  150.         Set oldPath to concatenation {macPath, "SAVE"}.
  151.         Set newName to concatenation {macPath, "Save"}.
  152.     Call rename.
  153.  
  154.     In rename,
  155.         Set oldPath to concatenation {macPath, "RENDER"}.
  156.         Set newName to concatenation {macPath, "Render"}.
  157.     Call rename.
  158.  
  159.     Copy bale "$PRODUCTCDROOT\\SUPPORT\\CMN\\GUIDE" to hdRootPath.
  160.  
  161.     // copy the shared bale. this is the bulk of what we install
  162.     Copy bale "$PRODUCTCDROOT\\SUPPORT\\CMN\\SHARED" to hdRootPath.
  163.  
  164.     // set up the ini file
  165.     Set currentinisection to an inisection of "MAIN" from file "DC.INI".
  166.  
  167.     // store the ugly mac constructs
  168.     Set currentinisection's MACVOL to macVol.
  169. //no reason to save these that I can see
  170. //    Set currentinisection's MACPATH to macPath.
  171. //    Set currentinisection's PCPATH to pcPath.
  172.  
  173.     // set up paths
  174.     Set currentinisection's HDROOT to concatenation {"$PRODUCTHDROOT", pcPath}.
  175.     Set currentinisection's SHARED to concatenation {"$PRODUCTHDROOT", pcPath, "\\SHARED"}.
  176.     Set currentinisection's SAVE to concatenation {"$PRODUCTHDROOT", pcPath, "\\SAVE"}.
  177.     Set currentinisection's RENDER to concatenation {"$PRODUCTHDROOT", pcPath, "\\RENDER"}.
  178.     Set currentinisection's SFX to concatenation {"$PRODUCTHDROOT", pcPath, "\\SFX"}.
  179.     Set currentinisection's MFX to concatenation {"$PRODUCTHDROOT", pcPath, "\\MFX"}.
  180.     Set currentinisection's DISK1 to "$PRODUCTCDROOT".
  181.     Set currentinisection's DISK2 to "$PRODUCTCDROOT".
  182.     Set currentinisection's DISK3 to "$PRODUCTCDROOT".
  183.  
  184.     Set currentinisection's VOLUME1 to "DC1".
  185.     Set currentinisection's VOLUME2 to "DC2".
  186.     Set currentinisection's VOLUME3 to "DC3".
  187.  
  188.     Set currentinisection's CODE to "DC1.0".
  189.  
  190.     Set currentinisection's allowTrueColorMode to "false".
  191.     Set currentinisection's wantTrueColorMode to "false".
  192.     Set currentinisection's kidProof to "yes".
  193.     Set currentinisection's borderColor to "0,0,0".
  194.  
  195.     Set currentinisection's MaxCacheSize to "5".
  196.  
  197.     // hide and lock many of the files we just installed
  198.  
  199.     Make a library named hideLockLib of "HideLock".
  200.     Make a libFunction named hideLock of "HideLock" from hideLockLib.
  201.     Record that hideLock is longOnResult.
  202.     In hideLock,
  203.         Make p1.  Set it to "".
  204.              
  205.         [ Note the values to be passed to the next 2 parameters are:
  206.            +1 to hide or lock
  207.            0  to leave unchanged
  208.            -1 to unhide or unlock
  209.  
  210.          Hide refers to the icon's visibility in the Finder.
  211.          NameLock controls whether the user can rename this file.
  212.          It's a good idea to NameLock all files that we look for by
  213.          name.
  214.         ]
  215.  
  216.         Make doHide.  Set it to 1.
  217.         Make doNameLock.  Set it to 1.
  218.  
  219.     In hideLock,
  220.         Set p1 to concatenation {macPath, "CMDLINE.TXT"}.
  221.     Call hideLock.
  222.  
  223.     In hideLock,
  224.         Set p1 to concatenation {macPath, "override.res"}.
  225.     Call hideLock.
  226.  
  227.     In hideLock,
  228.         Set p1 to concatenation {macPath, "PLCHLDR.TXT"}.
  229.     Call hideLock.
  230.  
  231.     In hideLock,
  232.         Set p1 to concatenation {macPath, "SHARED"}.
  233.     Call hideLock.
  234.  
  235.     In hideLock,
  236.         Set p1 to concatenation {macPath, "GUIDE"}.
  237.     Call hideLock.
  238.  
  239.     In hideLock,
  240.         Set p1 to concatenation {macPath, "START.PAC"}.
  241.     Call hideLock.
  242.  
  243.     In hideLock,
  244.         Set p1 to concatenation {macPath, "START.INF"}.
  245.     Call hideLock.
  246.  
  247.     In hideLock,
  248.         Set p1 to concatenation {macPath, "START.DNF"}.
  249.     Call hideLock.
  250.  
  251.     In hideLock,
  252.         Set p1 to concatenation {macPath, "START.DAC"}.
  253.     Call hideLock.
  254.  
  255.     In hideLock,
  256.         Set p1 to concatenation {macPath, "START.DNA"}.
  257.     Call hideLock.
  258.  
  259.     In hideLock,
  260.         Set p1 to concatenation {macPath, "OpenFile"}.
  261.     Call hideLock.
  262.  
  263.     In hideLock,
  264.         Set p1 to concatenation {macPath, "SaveFile"}.
  265.     Call hideLock.
  266.  
  267.     In hideLock,
  268.         Set p1 to concatenation {macPath, "CDSwap"}.
  269.     Call hideLock.
  270.  
  271.     In hideLock,
  272.         Set p1 to concatenation {macPath, "Save"}.
  273.     Call hideLock.
  274.  
  275.     In hideLock,
  276.         Set p1 to concatenation {macPath, "Render"}.
  277.     Call hideLock.
  278.  
  279.     // we only lock the name of the executables, we don't hide them!
  280.     In hideLock,
  281.         Set doHide to 0.
  282.         Set p1 to concatenation {macPath, "Director's Chair"}.
  283.     Call hideLock.
  284.  
  285.     In hideLock,
  286.         Set doHide to 0.
  287.         Set p1 to concatenation {macPath, "Director's Chair User's Guide"}.
  288.     Call hideLock.
  289.  
  290.     Detach the_screen's please_wait.
  291.  
  292.     Make the_screen's finish. Set it to a picture of finish.cmp at 320,240 sized 320,240.
  293.     Set it's bitmap's palette to the_screen's hack's bitmap's palette.
  294.     Wait until the next cycle.
  295.  
  296.     In the_screen,
  297.         Make the_mac_path. Set it to macPath.
  298.  
  299.         When downClicked,
  300.             Make a library named openFldrLib of "openFldr".
  301.             Make a libFunction named openFldr of "openFldr" from openFldrLib.
  302.             In openFldr,
  303.                 Make macPath. Set it to concatenation {the_mac_path, "Director's Chair"}.
  304.             Call openFldr.
  305.  
  306.             Fade this screen to black in 0.7 sec.
  307.             End this program.
  308.  
  309.