home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / varie / gdtrash1.1rev.2 / copyto / copytotrashscript.dopus5
Text File  |  1999-09-18  |  2KB  |  68 lines

  1. /*
  2.    This script must be placed in the DOpus5:System/CopyTo directory 
  3.    (create it if it doesn't already exist). 
  4.    You must set the comment of the script file to the entry
  5.    you want displayed in the CopyTo menu. You must also set the S
  6.    protection bit.
  7.  
  8.    This will cause an entry to be created in the Copy >> menu in 
  9.    file and directory popup menus. Selecting this entry will
  10.    cause the script to be launched.
  11. */
  12.  
  13. parse arg filename portname source
  14. options results
  15.  
  16. If ~Show("P",'trash-handler') then do
  17.     dopus request '"WARNING!!!:"'|| '0a'x ||'" Global Trash is not running!!" OK'
  18.     Exit
  19. End
  20.  
  21. if open(1,'Env:trash.prefs','R') then do
  22.     do i=1 to 6
  23.         prefs.i = readln(1)
  24.     end
  25.         
  26.     if prefs.4 ~="" then trashpath=prefs.4
  27.     Call close(1)
  28. end
  29.  
  30. filename=strip(filename,B,'"')
  31. if pos(":",filename)~=0 then do
  32.     parse var filename ':'filename1
  33.     if lastpos("/",filename1)=length(filename1) then do
  34.         type = 1
  35.         filename1=delstr(filename1,lastpos("/",filename1),length(filename1))
  36.         if pos("/",filename1)~=0 then do
  37.             do until pos("/",filename1)=0
  38.                 parse var filename1 '/'filename1
  39.             end
  40.         end
  41.     end
  42. else do
  43.     if pos("/",filename1)~=0 then do
  44.         do until pos("/",filename1)=0
  45.             parse var filename1 '/'filename1
  46.         end
  47.     end
  48.     type = -1
  49. end
  50. printpath=delstr(filename,pos(filename1,filename),length(filename))
  51.  
  52. if type < 0 then do
  53.     /* Only Files */
  54.     address command 'Move 'filename' to 'trashpath''
  55.     address command 'Echo >'trashpath||filename1||.path' 'printpath''
  56.     Address Command 'SetDate 'trashpath||filename1''
  57. end
  58.  
  59. if type > 0 then do
  60.     /* Dirs */
  61.     address command 'Move 'filename' to 'trashpath||filename1''    
  62.     address command 'Echo >'trashpath||filename1||.path' 'printpath''
  63.     Address Command 'SetDate 'trashpath||filename1''
  64. end
  65. lister refresh source full
  66. dopus checkdesktop printpath
  67.  
  68.