home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / trashcan.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1995-08-26  |  1KB  |  59 lines

  1. /*
  2.  * Install WPTrashCan class, Trashcan object
  3.  * (c) Henicke, Andreas 1995 Rostock
  4.  */
  5.  
  6. parse arg arglist .
  7. call rxfuncadd 'sysloadfuncs','rexxutil','sysloadfuncs'
  8. call sysloadfuncs
  9.  
  10. parse value sysos2ver() with major'.'minor
  11.  
  12. veros2=major*100+left(minor,2,0)
  13.  
  14. /* test os/2 version (os/2 warp3: 2.30) */
  15. if veros2<230 then do
  16.    say 'need OS version 2.30 and above'
  17.    exit
  18. end
  19.  
  20. /* PrÜfe vorhandene Dateien */
  21. call sysfiletree '.\trashcan.dll',   ll0, 'FO'
  22. if ll0.0=0 then do
  23.    say 'error: miss .\trashcan.dll'
  24.    exit
  25. end
  26.  
  27. /* get [d:]\os2\dll directory */
  28. template='\os2\dll'
  29. path=''
  30. ds=sysdrivemap(c, local)
  31. do di=1 to ((length(ds)+1)/3)-1
  32.    dd=word(ds, di);
  33.    call sysfiletree dd || template, dl, 'DO'
  34.    if dl.0<>0 then do
  35.       path=translate(dl.1)
  36.       leave
  37.    end
  38. end
  39. if path=='' then do
  40.    say 'error: miss ' template
  41.    exit
  42. end
  43. dllpath=path || '\trashcan.dll'
  44. call sysfiletree dllpath, tl, 'FO'
  45. if tl.0<>0 then do
  46.    say 'error: found' dllpath
  47.    exit
  48. end
  49.  
  50. /* copy trashcan.dll in [d:]\os2\dll */
  51. address cmd '@copy trashcan.dll' dllpath '> NUL'
  52.  
  53. /* register class WPTrashCan and create object <TRASHCAN> */
  54. call sysregisterobjectclass 'WPTrashCan', dllpath
  55. call syscreateobject 'WPTrashCan','Trashcan','<WP_DESKTOP>','OBJECTID=<TRASHCAN>'
  56.  
  57. exit
  58.  
  59.