home *** CD-ROM | disk | FTP | other *** search
/ Blender Volume 3 #4 / Blender_3_4.iso / BLENDER / FILES / ADV_FUNC.CST / 00001.ls next >
Encoding:
Text File  |  1997-01-01  |  6.2 KB  |  240 lines

  1. global gOpSys
  2.  
  3. -- handler getTrackingInfo
  4. --  reads tracking file and appends contest information
  5. --  saves the result in global variables
  6. --  textStringBig and textStringLittle
  7. --
  8. -- Closely based on handler createContestForm
  9. --
  10. on getTrackingInfo
  11.   
  12.   global trackList
  13.   
  14.   set prefsPath = findPath()
  15.   
  16. --  -- make sure the xtra is open
  17. --  set openLibs = xFactoryList(EMPTY)
  18. --  if NOT(openLibs contains "fileio") then
  19. --    set status = "getTrackingInfo: xtra not available"
  20. --    return status
  21. --    exit
  22. --  end if
  23.   
  24.   -- reads the prefs file
  25.   -- include token TAB  between each item
  26.   set readObj = new(xtra "FileIO")
  27.   if not objectP(readObj) then
  28.     put "getTrackingInfo: object instantiation error"
  29.     exit
  30.   end if
  31.   
  32.   openFile(readObj, prefsPath&"Blendprf", 1)
  33.   
  34.   -- 
  35.   -- read the file line by line... do not read more than 
  36.   -- 50 carriage return delimited lines so that
  37.   -- the size of the printout is not too large
  38.   --
  39.   set thisLine = readLine(readObj)
  40.   set lineCount = 1
  41.   set OUTPUT = EMPTY
  42.   
  43.   repeat while (thisLine <> EMPTY) AND (lineCount <= 50)
  44.     set OUTPUT = OUTPUT & thisLine
  45.     set thisLine = readLine(readObj)
  46.     set lineCount = lineCount + 1
  47.   end repeat
  48.   
  49.   closeFile(readObj)
  50.   set readObj = 0
  51.   
  52.   set disclaimer = "The following information tracks your viewing of Blender. ┬¼
  53. It is used to improve the product."
  54.   
  55.   set textString = disclaimer & RETURN & RETURN & OUTPUT
  56.   
  57.   return textString
  58.   
  59. end getTrackingInfo
  60.  
  61.  
  62.  
  63.  
  64. --
  65. -- function saveToText
  66. --
  67. -- utility handler writes to a text file
  68. -- INPUT:
  69. --      > file_name    type STRING: the name of the file
  70. --      > file_loc     type SYMBOL: the location of the file
  71. --                          #WINWIN    the Windows directory
  72. --                          #WINSYS    the Windows/System directory
  73. --                          #MACPRF    the mac Preferences folder
  74. --      > file_cont    type STRING: the contents of the file
  75. --      > file_mode    type SYMBOL: the type of write
  76. --                          #OVERWRITE  replace previous contents, if any
  77. --                          #APPEND     append to previous contents, if any
  78. -- OUTPUT:
  79. --      < status       type STRING:   error checking variable
  80. --                          "OK"    file written correctly
  81. --                          [error]   string containing error type
  82. --
  83.  
  84. on saveToText file_name, file_loc, file_cont, file_mode
  85.   
  86.   if paramCount() <> 4 then 
  87.     put "saveToText requires 4 parameters:"
  88.     put "file_name, file_loc, file_cont, file_mode"
  89.     set status = "parameter count error"
  90.     return status
  91.     exit
  92.   end if
  93.   
  94.   if NOT( stringP(file_name) ) OR NOT( stringP(file_cont) )┬¼
  95.  OR NOT(symbolP(file_loc) ) OR NOT( symbolP(file_mode) ) then
  96.     set status = "saveToText: incorrect parameter type"
  97.     return status
  98.     exit
  99.   end if
  100.   
  101. --  -- make sure the xtra is open
  102. --  set openLibs = xFactoryList(EMPTY)
  103. --  if NOT(openLibs contains "fileio") then
  104. --    set status = "saveToText: xtra not available"
  105. --    return status
  106. --    exit
  107. --  end if
  108.   
  109.   if ((gOpSys = #WIN16) OR (gOpSys = #WIN32)) then
  110.     set winMachine = TRUE
  111.   else
  112.     set winMachine = FALSE
  113.   end if
  114.   
  115.   set sysPath = findPath()
  116.   
  117.   if (file_loc = #WINWIN) AND (winMachine = TRUE) then
  118.     set filePath = sysPath & "\"
  119.   else if (file_loc = #MACPRF) AND NOT(winMachine) then
  120.     set filePath = sysPath & "\"
  121.   else if (file_loc = #WINSYS) AND (winMachine = TRUE) then 
  122.     set filePath = sysPath & "\SYSTEM\"
  123.   else 
  124.     set status = "file_loc error"
  125.     return status
  126.     exit
  127.   end if
  128.   
  129.   if file_name = EMPTY then
  130.     set status = "file_name EMPTY error"
  131.     return status
  132.     exit
  133.   end if
  134.   
  135.   if file_cont = EMPTY then
  136.     set status = "file_cont EMPTY error"
  137.     return status
  138.     exit
  139.   end if
  140.   
  141.   if file_mode = #OVERWRITE then
  142.     set writeObj = new(xtra "FileIO")
  143.     openFile(writeObj, filePath & file_name, 2)
  144.     delete(writeObj)
  145.     createFile(writeObj, filePath & file_name)
  146.     openFile(writeObj, filePath & file_name, 2)
  147.   else if file_mode = #APPEND then
  148.     set writeObj = new(xtra "FileIO")
  149.     createFile(writeObj, filePath & file_name)
  150.     openFile(writeObj, filePath & file_name, 2)
  151.     set fileLen = getLength(writeObj)
  152.     setPosition(writeObj,fileLen) -- set the position to the end of the file   
  153.   else
  154.     set status = "file_mode error"
  155.     return status
  156.     exit
  157.   end if
  158.   
  159.   if NOT( objectP(writeObj) ) then
  160.     set status = "file creation error"
  161.     return status
  162.     exit
  163.   end if
  164.   
  165.   writeString(writeObj,  file_cont )
  166.   closeFile(writeObj) 
  167.   set writeObj = 0 
  168.   
  169.   set status = "OK"
  170.   return status
  171.   
  172. end saveToText
  173.  
  174.  
  175.  
  176. --
  177. -- handler CopyAOL
  178. -- copies the America OnLine installer
  179. -- to the root directory of the user's hard drive.
  180. -- The installer should be located in the root of the Blender CD.
  181. -- Change Mac and Window installer names
  182. -- to suit actual file names.
  183. --
  184. on CopyAOL
  185.   global SYSdrive
  186.   global CDdrive
  187.   global MX
  188.   
  189.   
  190.   if the machineType = 256 then
  191.     openXLib "MISC_X"
  192.   else  
  193.     --openXLib CDdrive&"FILES:MISC_X XObj"
  194.   end if
  195.   if not objectp(MX) then set MX = misc_x(mnew)
  196.   
  197.   if the machineType = 256 then
  198.     set fileName = "BLENDER\GNN\SETUP.EXE"
  199.     set sourcePath = CDdrive & fileName
  200.     set destPath = SYSdrive & "GNNBLEND\SETUP.EXE"
  201.     put sourcePath, destPath
  202.     set folderCheck = MX(mInsureFolder,SYSDrive&"GNNBLEND\")
  203.     alert "Now copying GNN installation software"
  204.   else
  205.     --    set fileName = "America Online v2.6:Install AOL v2.6 w/Browser"
  206.     --    set sourcePath = CDdrive & fileName
  207.     --    set destPath = SYSdrive & fileName
  208.     alert "This software is not for Macintosh computers!"
  209.     
  210.   end if
  211.   if the machineType = 256 then
  212.     
  213.     set copyInst =  MX(mCopyFile, sourcePath, destPath)
  214.     
  215.     if copyInst <> 1 then 
  216.       alert "We couldn't copy the GNN installer. ┬¼
  217. Sorry to make you do all the work, but drag it onto your hard drive from the CD-ROM."
  218.     else 
  219.       alert "The installer has been successfully copied."
  220.     end if
  221.     
  222.     
  223.     
  224.     if objectp(MX) then MX(mDispose)
  225.   end if
  226.   
  227.   if the machineType = 256 then
  228.     closeXLib "MISC_X"
  229.   else  
  230.     --closeXLib CDdrive&"FILES:MISC_X XObj"
  231.   end if
  232.   
  233. end CopyAOL
  234.  
  235.  
  236. on techDirectorInit
  237.   global volName, TRACKINGflag
  238.   set volName = "3.4"
  239.   set  TRACKINGflag = false
  240. end techDirectorInit