home *** CD-ROM | disk | FTP | other *** search
/ CyberStratege 8 / CyberStratege_CD_08.iso / h-c.dxr / 00075_Text_75.txt < prev    next >
Text File  |  1983-06-06  |  7KB  |  282 lines

  1. on pouetpouet
  2.   --A collection of Windows Utilitys for Director.
  3.   --This collection is provided for FREE ... Test and Test often.
  4.   --If  you can think of more utilities to add to this collection, please
  5.   --email your suggestions to us.  We are trying to build a powerstation,
  6.   --but we are starting with a battery.
  7.   --
  8.   --EMAIL -  p.farry@cqu.edu.au   (Paul Farry)
  9.   --or  kennedym@topaz.cqu.edu.au (Matthew Kennedy)
  10.   --
  11.   --Even if you can't think of any suggestions for new stuff, but you like what we've done
  12.   --please email both of us and say so....We look forward to feedback.
  13.   --
  14.   
  15. on startmovie
  16.   opendirutil
  17.   if xfactorylist("Fileio") =EMPTY then openxlib "FileIO"
  18. end
  19.  
  20. on stopmovie
  21.   --make sure your done all your fileio related mDisposes
  22.   if xfactorylist("Fileio") <> EMPTY then closexlib "FileIO"
  23.   closedirutil
  24. end
  25.  
  26. on openDirutil
  27.   global x
  28.   openxlib("DirUtil")
  29.   set x = DirUtil(mNew)
  30. end 
  31.  
  32. on closeDirUtil
  33.   global x
  34.   x(mDispose)
  35.   closexlib("DirUtil")
  36. end
  37.  
  38.  
  39. on qtversion
  40.   global x
  41.   put x(mQTVersion) into field "QTVersion"
  42. end
  43.  
  44. on qtversionstring
  45.   global x
  46.   put x(mQTVersionStr) into field "QTVersionString"
  47. end
  48.  
  49. on setattrib afilename
  50.   global s_util
  51.   --NORMAL   00   /* Normal file, no attributes */
  52.   --RDONLY   01   /* Read only attribute */
  53.   --HIDDEN    02 /* Hidden file */
  54.   --SYSTEM    04 /* System file */
  55.   --ARCH        32 /* Archive */
  56.   --to get combinations add together the numbers
  57.   if voidp(aFilename) then
  58.     set f = fileio(mNew,"?read","*")
  59.     if objectp(f) then
  60.       set afilename = f(mFilename)
  61.       f(mdispose)
  62.     end if
  63.   end if
  64.   if not voidp(aFilename) then
  65.     s_util(mSetAttrib,afilename,00) --presently it will set a file to NORMAL
  66.   end if
  67. end
  68.  
  69. on  getfileattrib afilename
  70.   global x
  71.   --NORMAL   00   /* Normal file, no attributes */
  72.   --RDONLY   01   /* Read only attribute */
  73.   --HIDDEN    02  /* Hidden file */
  74.   --SYSTEM    04  /* System file */
  75.   --LABEL       08  /*volume label*/
  76.   --DIR            16  /*directory*/
  77.   --ARCH        32  /* Archive */
  78.   --to get combinations add together the numbers
  79.   if voidp(aFilename) then
  80.     set f = fileio(mNew,"?read","*")
  81.     if objectp(f) then
  82.       set afilename = f(mFilename)
  83.       f(mdispose)
  84.     end if
  85.   end if
  86.   if not voidp(aFilename) then
  87.     
  88.     set attrib = x(mgetattrib,afilename)
  89.     set at = string(attrib)&": "
  90.     if (x(mbitAND,attrib,1)<>0) then
  91.       set at = at & "R"
  92.     else
  93.       set at = at &"_"
  94.     end if
  95.     if (x(mbitAND,attrib,2)<>0) then
  96.       set at = at & "H"
  97.     else
  98.       set at = at &"_"
  99.     end if
  100.     if (x(mbitAND,attrib,4)<>0) then
  101.       set at = at & "S"
  102.     else
  103.       set at = at &"_"
  104.     end if
  105.     if (x(mbitAND,attrib,8)<>0) then
  106.       set at = at & "L"
  107.     else
  108.       set at = at &"_"
  109.     end if
  110.     if (x(mbitAND,attrib,16)<>0) then
  111.       set at = at & "D"
  112.     else
  113.       set at = at &"_"
  114.     end if
  115.     if (x(mbitAND,attrib,32)<>0) then
  116.       set at = at & "A"
  117.     else
  118.       set at = at &"_"
  119.     end if
  120.     
  121.   else
  122.     set at="No Filename"
  123.   end if
  124.   put at into field "Attribute"
  125. end
  126.  
  127. on testfileattr
  128.   getfileattrib("c:\msdos.sys")
  129.   put field "attribute"
  130. end
  131.  
  132. on GetDriveType  adrivenum
  133.   global x,drives
  134.   set drives = ["DRIVE_UNDETERMINED","DRIVE_NOTEXIST",┬¼
  135.                          "DRIVE_REMOVABLE","DRIVE_FIXED","DRIVE_REMOTE"]
  136.   if voidp(adrivenum) then 
  137.     put value(field "DriveNum") into adrivenum
  138.   end if
  139.   set drtypeno=  x(mGetDriveType,adrivenum)
  140.   set drtype = getat(drives,drtypeno+1)
  141.   put drtype into field "DriveType"
  142. end
  143.  
  144. on WhereISCDRom
  145.   global x
  146.   set hit = false
  147.   set count = 0
  148.   repeat while (hit = false) and (count < 50)
  149.     if x(mIsCDRom,count) then
  150.       set hit = true
  151.       set driveletter = numtochar(count+65)
  152.     end if
  153.     set count = count + 1
  154.   end repeat
  155.   if hit = false then
  156.     set driveletter = "No CDROM Found"
  157.   end if
  158.   put driveletter &":" into field "CD-ROM"
  159. end
  160.  
  161. on authors
  162.   global x
  163.   put x(mAuthors) into field "Author Info" 
  164. end
  165.  
  166. on seterroron
  167.   global x
  168.   
  169.   -- 01critical-error-handler message box and returns the error to the calling application. 
  170.   -- 02 general-protection-fault message box. This flag should be set only 
  171.   --       by debugging applications that  handle GP faults themselves. 
  172.   -- 32768 message box when it fails to find  a file. 
  173.   
  174.   x(mSetErrormode,1)
  175.   --Windows errors OFF
  176. end
  177.  
  178. on seterroroff
  179.   global x
  180.   x(mSetErrorMode,0)
  181.   --Windows errors ON
  182. end
  183.  
  184. On testmessagebox
  185.   set   mb_Ok                     = 0000
  186.   set  mb_OkCancel         =0001
  187.   set  mb_AbortRetryIgnore = 0002
  188.   set mb_YesNoCancel      = 0003
  189.   set  mb_YesNo            = 0004
  190.   set  mb_RetryCancel      = 0005
  191.   --
  192.   set  mb_IconHand         = 0016
  193.   set  mb_IconQuestion     = 0032
  194.   set  mb_IconExclamation  = 0048
  195.   set  mb_IconAsterisk     = 0064
  196.   --
  197.   set  mb_IconInformation  = mb_IconAsterisk
  198.   set  mb_IconStop         = mb_IconHand
  199.   --
  200.   set  mb_DefButton1       = 0000
  201.   set  mb_DefButton2       = 256
  202.   set  mb_DefButton3       = 512
  203.   --
  204.   set  mb_ApplModal        = 0000
  205.   set  mb_SystemModal      = 4096
  206.   set  mb_TaskModal       =  8192
  207.   --
  208.   set  mb_NoFocus          = 32768
  209.   --
  210.   set  mb_TypeMask         = 15
  211.   set  mb_IconMask         = 240
  212.   set  mb_DefMask          = 3840
  213.   set  mb_ModeMask         = 12288
  214.   set  mb_MiscMask         = 49152
  215.   --
  216.   global x
  217.   
  218.   put x(mMessageBox,"Caption","text",mb_AbortRetryIgnore +mb_IconExclamation+mb_DefButton3 )
  219.   
  220. end
  221.  
  222.  
  223. on testerrors
  224.   whereiscdrom
  225.   put field "CD-ROM" into cdpath
  226.   put cdpath
  227.   set errortest = fileio(mNew,"read",cdpath &"\Garbage.txt")
  228.   if objectp(errortest) then 
  229.     alert "IT's found"
  230.     errortest(mDispose)
  231.   else 
  232.     alert "It's not found"
  233.   end if
  234. end 
  235.  
  236. on testPath
  237.   global x
  238.   set the text of cast "pathtext" = x(mGetEnvironVar,"PATH") 
  239. end
  240.  
  241. on testfontnames
  242.   global x
  243.   put x(mFontList) into s
  244.   set fontlist = []
  245.   repeat with i = 1 to the number of lines in s 
  246.     append(fontlist,line i of s)
  247.   end repeat
  248.   sort fontlist
  249.   repeat with i = 1 to count(fontlist)
  250.     put getat(fontlist,i) into line i of field "FontNames"
  251.   end repeat
  252. end
  253.  
  254. On testCopyToCast
  255.   global x
  256.   --set nm= findEmpty(member 1)
  257.   set x1 = random(300)
  258.   set y1 = random(300)
  259.   set x2 = x1+100
  260.   set y2 = y2+100
  261.   x(mCopyToClipBoard,x1,y1,x2,y2)
  262.   pasteClipBoardInto  member 45
  263.   --put "Should be in cast ",nm  
  264. end
  265.  
  266.  
  267. on testFileCopy sourcefilename,destinationfilename
  268.   global x
  269.   return x(mFileCopy,sourcefilename,destinationfilename)
  270. end
  271.  
  272.  
  273. --ISI    mSetAttrib,filename,attrib --Sets the Attibute of attr
  274. --IS     mgetfileattrib,filename     --Gets the Attibute of filename
  275. --II     mGetDriveType,drivenumber --Gets the type of a drive selected
  276. --I      mQTVersion              --Returns an integer status code
  277. --S      mQTVersionStr           --Returns version as a string 
  278. --II     mIsCdrom,drivenumber    --Return true if drive CDROM 
  279. --S      mAuthors                --Information on authors
  280. --XI     mSetErrorMode,mode      --sets windoze error mode 
  281. end pouetpouet
  282.