home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / disk utilities / dirutil / dopus / opus5utils / arexx / parenttodest.dopus5 < prev    next >
Encoding:
Text File  |  1997-11-21  |  2.8 KB  |  85 lines

  1. /* ParentToDest for Directory Opus 5.
  2.    By Leo Davidson ("Nudel", Pot-Noodle/Gods'Gift Utilities)
  3.  
  4. $VER: ParentToDest.dopus5 1.2 (18.8.95)
  5.  
  6.    NOTE: This script _requires_ DOpus v5.11 or above.
  7.  
  8.    The scrips changes the DEST lister's path to the PARENT of the SOURCE
  9.    lister's path.
  10.  
  11.    If the parent directory does not exists (e.g. you're in the ROOT of a
  12.    volume), the DEST lister will show a device-list, reqtools-style.
  13.  
  14.    v1.00 -> v1.01 - Now (attempts to) add rexxsupport.library if it hasn't
  15.                     been added already.
  16.                     Now checks to make sure the DOPUS.x port exists.
  17.                     Some minor tidying up.
  18.                     Now works with paths with spaces in. (Thx Trevor).
  19.     v1.01 -> v1.2 - Now uses Show() instead of ShowList(). (Thanks Stoebi)
  20.                     Style Guide compliant version numbering and $VER string.
  21.  
  22. Call as:
  23. ------------------------------------------------------------------------------
  24. ARexx    DOpus5:ARexx/ParentToDest.dopus5 {Qp}
  25. ------------------------------------------------------------------------------
  26. Turn off all switches.
  27. */
  28.  
  29. options results
  30. options failat 99
  31. signal on syntax;signal on ioerr        /* Error trapping */
  32. parse arg DOpusPort
  33. DOpusPort = Strip(DOpusPort,"B",'" ')
  34.  
  35. If DOpusPort="" THEN Do
  36.     Say "Not correctly called from Directory Opus 5!"
  37.     Say "Load this ARexx script into an editor for more info."
  38.     EXIT
  39.     END
  40. If ~Show("P",DOpusPort) Then Do
  41.     Say DOpusPort "is not a valid port."
  42.     EXIT
  43.     End
  44. Address value DOpusPort
  45.  
  46. If ~Show("L","rexxsupport.library") Then Do
  47.     AddLib("rexxsupport.library",0)
  48.     dopus request '"' || "'rexxsupport.library' had to be added to your system." || '0a'x || "If you don't have this (standard) library, your machine may crash!" || '0a'x || "(This is an ARexx problem, not my fault!)" || '0a0a'x || "You should add this line to your user-startup:" || '0a'x || "SYS:RexxC/RxLib >NIL: rexxsupport.library 0 -30 0" || '" OK'
  49.     End
  50.  
  51. /* Note - There is no reliable way to see if a library was actually added
  52.           or not. Blame ARexx, not me! - In fact, when I added a library
  53.           that didn't exist and then tried a dud function, my machine
  54.           gurued. */
  55.  
  56. lister query source stem source_handle.
  57.  
  58. IF source_handle.count = 0 | source_handle.count = "SOURCE_HANDLE.COUNT" Then Do
  59.     dopus request '"You must have a SOURCE lister!" OK'
  60.     EXIT
  61.     End
  62.  
  63.  
  64. lister query dest stem dest_handle.
  65.  
  66. IF dest_handle.count = 0 | dest_handle.count = "DEST_HANDLE.COUNT" Then Do
  67.     dopus request '"You must have a DESTINATION lister!" OK'
  68.     EXIT
  69.     End
  70.  
  71.  
  72. lister query source_handle.0 path
  73. source_path = RESULT||"/"
  74.  
  75. If EXISTS(source_path) Then
  76.     lister read dest_handle.0 '"'||source_path||'"'
  77. Else do
  78.     lister set dest_handle.0 source
  79.     command "devicelist FULL"
  80.     lister set source_handle.0 source
  81.     End
  82.  
  83. syntax:;ioerr:                /* In case of error, jump here */
  84. EXIT
  85.