Table of Contents

About

The following is a small AREXX script to open a Workbench window for all selected directories in Directory Opus 4.x.

Download

How to Install

  1. Extract the archive
  2. Place DOpus4-OpenWindow.rexx wherever you see fit (it is tidy, for example, to create an ARexx directory in DOPUS4: and then place your scripts there).
  3. Open DirectoryOpus4 and right-click and go to Project→Configure
  4. On the screen that pops-up, go to Buttons and create a new button somewhere where you see fit.
    1. Give the button a name (Open Window, for example) and create a new entry.
    2. Set the cycler to ARexx and click the magnifying glass to enter the path to the DOpus4-OpenWindow.rexx script.
  5. You do not need to set any flags.
  6. Save and exit and you are done.

How To Use

Select one or more directories in Directory Opus and click the button to open a Workbench window for all selected directories.

Code

DOpus4-OpenWindow.rexx
/*
 *  $VER: DOpus4-OpenWindow 1.0 (03 Dec 2021) by Wizardry and Steamworks
 *
 *      © 2021 Wizardry and Steamworks
 *
 *  PROGRAMNAME:
 *      DOpus4-OpenWindow
 *
 *  FUNCTION:
 *      Opens a Workbench window from selected directories.
 *
 *  USAGE:
 *      ARexx command DOpus4-OpenWindow.rexx (from DOpus)
 *
 *  $HISTORY:
 *
 *  03 Dec 2021 : 1.0 : initial release
 */
 
Opus = Address()    /* Get the DOpus address. */
Options RESULTS     /* Request results. */
Address value Opus  /* Use the DOpus address. */
 
Busy On
 
Status 3                    /* Get this window. */
ThisWindow = RESULT
 
/* Get this window's selected items. */
TopText "Getting this window's items..."
GetSelectedAll '*' ThisWindow               /* Split entries by delimiter since we may have spaces. */
ThisItems = RESULT
If ThisItems = 'RESULT' Then                /* If no items in this window then bail. */
    Do
        TopText "No items selected in this window!"
        Busy Off
        Exit
    End
 
/* Normalize, heh... */
AllItems = Translate(Translate(ThisItems, '/', ' '), ' ', '*')
 
Count = Words(AllItems)
Do i = 1 To Count
    ThisName = SubWord(AllItems, i, 1)
 
    /* If the file is not selected, then skip it. */
    If Find(AllItems, ThisName) = 0 Then Iterate i
 
    /* Restore original spaces. */
    FullName = Translate(ThisName, ' ', '/')
 
    /* Get the path to the entry. */
    Status 13 i + 1
    Path = RESULT
 
    /* Compose the directory name. */
    FilePath = Path||FullName
 
    /* Scroll to the item. */
    ScrollToShow Translate(ThisName, ' ', '/')
 
    /* Open the directory. */
    Address workbench WINDOW '"'FilePath'"' OPEN FRONT
 
    /* Don't deselect if operation failed. */
    If RC ~= 0 Then Iterate i
 
    /* Deselect entry. */
    SelectEntry i - 1 ||' '|| 0 ||' '|| 1   
End
 
TopText "(>*.-)/ There you go!"
Busy Off
Exit