home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 5 / CD_Magazyn_EXEC_nr_5.iso / Recent / biz / dopus / DOpusRxTrash.lha / Trashcan.dopus5 < prev    next >
Text File  |  2001-06-01  |  3KB  |  109 lines

  1. /* Global trashcan for Directory Opus 5.5
  2.    by Stefano Regattin with the precious help of Dave Clarke
  3.    http://utenti.tripod.it/esseerre/Stefano.html
  4.    e-mail: esserre@lycos.it
  5.    $VER: Trashcan.dopus5 1.0 (1.6.2001)
  6. Please change birth date: */
  7. MyBirthDate=8111966
  8. LF='0a'x
  9. Options Results
  10. Options FailAt 21
  11. Lib='rmh.library'
  12. If ~Show('L',Lib) Then
  13. Do
  14.  If ~AddLib(Lib,0,-30) Then Exit
  15.  If AddLibrary('rexxsupport.library')~=0 Then Exit
  16.  If ~OpenPort(trashport) Then Do
  17.   Say 'I cannot put the trashcan!'
  18.   Exit
  19.  End
  20.  TrashcanMenu.count=3
  21.  TrashcanMenu.0='Recycle'
  22.  TrashcanMenu.1='---'
  23.  TrashcanMenu.2='Empty'
  24.  Argument.count=5
  25.  Dopus AddAppIcon trashport "Trashcan" 'MyBirthDate' icon "ENVARC:Sys/def_trashcan" close info local menu Trashcan Menu
  26.  Icon=RESULT
  27.  Do Until Uscita=1
  28.   Event=PortSignal(trashport)
  29.   If CheckSignal(Event)~=0 Then
  30.   Do
  31.    Packet=GetPkt(trashport)
  32.    If Packet~=Null() Then
  33.    Do
  34.     Do Argument=0 To 4
  35.      Argument.Argument=GetArg(Packet,Argument)
  36.     End
  37.     Call Reply(Packet,0)
  38.     Select
  39.     When Argument.0='dropfrom' Then
  40.     Do
  41.      Lister Query Source
  42.      SourceList=RESULT
  43.      Lister Query SourceList Path
  44.      FilePath=RESULT
  45.      Parse Var FilePath Device ":" FilePath
  46.      FileName=Argument.2
  47.      Parse Var Device "X" Device /* XHF filter */
  48.      File=Device":"FilePath||FileName
  49.      If Exists(File) Then
  50.      Do
  51.       Address Command 'Run Copy 'File' 'Device':Trashcan ALL CLONE'
  52.       Address Command 'Run Delete 'File''
  53.       Dopus Request '"'File' put into the trashcan" OK'
  54.       FileIcon=File".info"
  55.       If Exists(FileIcon) Then
  56.       Do
  57.        Address Command 'Run Copy 'FileIcon' 'Device':Trashcan ALL CLONE'
  58.        Address Command 'Run Delete 'FileIcon''
  59.        Dopus Request '"'FileIcon' put into the trashcan" OK'
  60.       End
  61.      End
  62.      Dopus Script 'Trashcan dropped'
  63.     End
  64.     When Argument.0='menu' Then
  65.     Do
  66.      Select
  67.      When Argument.2=0 Then
  68.      Do
  69. /* change the devices to suit to your needs */
  70.       Do Device=0 To 6
  71.        Address Command 'Run Copy DH'Device':Trashcan/#? RAM: ALL CLONE'
  72.        Address Command 'Run Delete DH'Device':Trashcan/#? ALL'
  73.       End
  74.       Dopus Request '"I have recycled all the files"'LF'"from all your trashcans"'LF'"to your RAM: device" OK'
  75.       Dopus Script 'Trashcan recycled'
  76.      End
  77.      When Argument.2=2 Then
  78.      Do
  79. /* change the devices to suit to your needs*/
  80.       Do Device=0 To 6
  81.        Address Command 'Run Delete DH'Device':Trashcan/#? ALL'
  82.       End
  83.       Dopus Request '"I have emptied all the trashcans" OK'
  84.       Dopus Script 'Trashcan emptied'
  85.      End
  86.      Otherwise NOP
  87.      End
  88.     End
  89.     When Argument.0='info' Then
  90.     Do
  91.      Dopus SetAppIcon BUSY ON
  92.      Dopus Request '"by Stefano Regattin with the precious help of Dave Clarke"'LF'"esseerre@lycos.it"'LF'"http://utenti.tripod.it/esseerre/Stefano.html" OK'
  93.      Do Until RC~=0
  94.      End
  95.      Dopus SetAppIcon BUSY OFF
  96.     End
  97.     When Argument.0='removed' Then Uscita=1
  98.     When Argument.0='close' Then Uscita=1
  99.     Otherwise NOP
  100.     End
  101.    End
  102.   End
  103.  End
  104.  Call ClosePort(trashport)
  105.  Dopus RemAppIcon Icon
  106.  Dopus Script 'Trashcan removed'
  107.  Exit
  108. End
  109.