/* * $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