home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / opus / v5 / deassign / deassign.lha / DeAssign.dopus5 next >
Text File  |  1997-07-29  |  3KB  |  100 lines

  1. /* DeAssign.dopus5 1.0 (29 JUL 97)
  2. ** by Charles Patterson <midian@azstarnet.com>
  3. ** http://www.azstarnet.com/~midian
  4. **
  5. ** Description: Removes all Assigns to the selected drawer then deletes
  6. **              the drawer (optional)
  7. **
  8. ** Requirements: Directory Opus v5.5 (© 1996 by Jonathan Potter & GPSoftware)
  9. **
  10. ** Instructions: Set DEL to 1 if you want it to delete the directory without
  11. **                   asking.
  12. **               Change the DEVICE and NAMES settings for your system
  13. **               Copy script to DOpus5:Arexx
  14. ** Create button
  15. ** ----------------------------------------------------------------------
  16. ** [ARexx]      DOpus5:ARexx/DeAssign.dopus5 {Qp} {f}
  17. ** ----------------------------------------------------------------------
  18. ** flags: Rescan source
  19. **
  20. ** --- Requester to delete drawer? --- */
  21. DEL=0
  22.  
  23. DEVICE.1="DH0:"
  24. NAME.1 = "Workbench:"
  25. DEVICE.2="DH1:"
  26. NAME.2 = "Work:"
  27. DEVICE.3="DH2:"
  28. NAME.3 = "Comms:"
  29. DEVICE.4="RAM:"
  30. NAME.4 = "Ram Disk:"
  31. DEVICES=4
  32.  
  33. OPTIONS RESULTS
  34.  
  35. TEMPFILE="T:Assignlist"
  36.  
  37. PARSE ARG DOpusPort path
  38. DOpusPort = STRIP(DOpusPort,"B",'" ')
  39. path = STRIP(path,"B",'" ')
  40.  
  41. IF DOpusPort="" THEN DO
  42.                 SAY "Not correctly called from Directory Opus 5!"
  43.                 SAY "Load this ARexx script into an editor for more info."
  44.                 EXIT
  45.     END
  46. If ~SHOW("P",DOpusPort) THEN DO
  47.                 SAY DOpusPort "is not a valid port."
  48.                 EXIT
  49.     END
  50.  
  51. ADDRESS VALUE DOpusPort
  52.  
  53. dopus version
  54. IF ( result='RESULT' | TRANSLATE(result,'.',' ') < 5.1218 ) THEN DO
  55.                 dopus request '"This script requires DOpus v5.5 or greater." OK'
  56.                 EXIT
  57.     END
  58.  
  59. count=0
  60. ADDRESS COMMAND 'ASSIGN DIRS >'TEMPFILE
  61. OPEN('assigns',TEMPFILE,'R')
  62. assign.=''
  63. n = 0
  64. line = READLN('assigns')
  65.  
  66. DO WHILE ~EOF('assigns')
  67.     line = READLN('assigns')
  68.     j=n
  69.     n=n+1
  70.     PARSE VAR line assign.n dir.n
  71.     dir.n=STRIP(dir.n)
  72.     IF assign.n="+" THEN assign.n=assign.j
  73.     dev=0
  74.     DO k=1 to DEVICES
  75.         IF LEFT(dir.n,POS(':',dir.n)) = NAME.k THEN dev=k
  76.     END
  77.     IF dev ~=0 THEN DO
  78.         dir.n=RIGHT(dir.n,LENGTH(dir.n)-POS(':',dir.n))
  79.         dir.n=DEVICE.dev||dir.n
  80.     END
  81.     IF dir.n = path THEN DO
  82.         count =  count +1
  83.         rassign.count = assign.n
  84.     END
  85. END
  86. CLOSE('assigns')
  87.  
  88. IF count>0 THEN
  89.     DO c = 1 to count
  90.         ADDRESS COMMAND 'ASSIGN 'rassign.c':'
  91.         IF ~DEL THEN DO
  92.             DOPUS REQUEST '"Do you wish to delete the directory?" Yes|No'
  93.             DEL=RC
  94.         END
  95.         IF DEL THEN ADDRESS COMMAND DELETE path
  96.     END
  97.  
  98. ADDRESS COMMAND DELETE TEMPFILE
  99. EXIT
  100.