/* ParentToDest for Directory Opus 5. By Leo 'Nudel' Davidson for Gods'Gift Utilities email: leo.davidson@keble.oxford.ac.uk www: http://info.ox.ac.uk/~kebl0364/ $VER: ParentToDest.dopus5 1.3 (26.12.95) NOTE: This script _requires_ DOpus v5.11 or above. NOTE: DOpusFuncs is an assembler version of this (and other) scripts. The scrips changes the DEST lister's path to the PARENT of the SOURCE lister's path. If the parent directory does not exists (e.g. you're in the ROOT of a volume), the DEST lister will show a device-list, reqtools-style. v1.00 -> v1.01 - Now (attempts to) add rexxsupport.library if it hasn't been added already. Now checks to make sure the DOPUS.x port exists. Some minor tidying up. Now works with paths with spaces in. (Thx Trevor). v1.01 -> v1.2 - Now uses Show() instead of ShowList(). (Thanks Stoebi) Style Guide compliant version numbering and $VER string. v1.2 -> v1.3 - No change to functionality. Call as: ------------------------------------------------------------------------------ ARexx DOpus5:ARexx/ParentToDest.dopus5 {Qp} ------------------------------------------------------------------------------ Turn off all switches. */ options results options failat 99 signal on syntax;signal on ioerr /* Error trapping */ parse arg DOpusPort DOpusPort = Strip(DOpusPort,"B",'" ') If DOpusPort="" THEN Do Say "Not correctly called from Directory Opus 5!" Say "Load this ARexx script into an editor for more info." EXIT END If ~Show("P",DOpusPort) Then Do Say DOpusPort "is not a valid port." EXIT End Address value DOpusPort If ~Show("L","rexxsupport.library") Then Do AddLib("rexxsupport.library",0) 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' End /* Note - There is no reliable way to see if a library was actually added or not. Blame ARexx, not me! - In fact, when I added a library that didn't exist and then tried a dud function, my machine gurued. */ lister query source stem source_handle. IF source_handle.count = 0 | source_handle.count = "SOURCE_HANDLE.COUNT" Then Do dopus request '"You must have a SOURCE lister!" OK' EXIT End lister query dest stem dest_handle. IF dest_handle.count = 0 | dest_handle.count = "DEST_HANDLE.COUNT" Then Do dopus request '"You must have a DESTINATION lister!" OK' EXIT End lister query source_handle.0 path source_path = RESULT||"/" If EXISTS(source_path) Then lister read dest_handle.0 '"'||source_path||'"' Else do lister set dest_handle.0 source command "devicelist FULL" lister set source_handle.0 source End syntax:;ioerr: /* In case of error, jump here */ EXIT