Table of Contents

About

The script adds a dummy file for .info files such that the snapshot feature will work. A good usage scenario is managing icon sets where icons will not stay put without a corresponding file for the .info file.

Download

How to Install

  1. Extract the archive
  2. Place DOpus4-AddInfoDummy.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 (AddInfoDummy, 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-AddInfoDummy.rexx script.
  5. You do not need to set any flags.
  6. Save and exit and you are done.

How To Use

After adding the button, locate one or more ".info" files which you want to create dummy files and press the button you created.

Developer Notes

The script uses a custom-implementation of some functions which can all be found on the ARexx FUSS page.

Code

DOpus4-AddInfoDummy.rexx
/*
 *  $VER: DOpus4-AddInfoDummy 1.0 (06 Jul 2015) by Wizardry and Steamworks
 *
 *      © 2015 Wizardry and Steamworks
 *
 *  PROGRAMNAME:
 *      DOpus4-AddInfoDummy
 *
 *  FUNCTION:
 *      Adds a dummy file for selected .info files.
 *
 *  USAGE:
 *      ARexx command DOpus4-AddInfoDummy.rexx (from DOpus)
 *
 *  $HISTORY:
 *
 *  06 Jul 2015 : 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... */
ThisItems = Translate(Translate(ThisItems, '/', ' '), ' ', '*')
 
/* Add dummy files for all selected .info files. */
TopText "Adding dummy files..."
GetAll '*' ThisWindow
AllItems = RESULT
 
/* Normalize, heh... */
AllItems = Translate(Translate(AllItems, '/', ' '), ' ', '*')
 
Count = Words(AllItems)
Do i = 1 To Count
    ThisName = SubWord(AllItems, i, 1)
 
    /* If the file is not selected, then skip it. */
    If Find(ThisItems, ThisName) = 0 Then Iterate i
    /* If the file is not an info file, then skip it. */
    If Pos('.info', ThisName) = 0 Then Iterate i 
 
    /* Create the new name without '.info'. */
    InfoName = SubStr(ThisName, 1, Length(ThisName)-5)
 
    /* If the new name is empty, then skip it. */
    If Length(InfoName) = 0 Then Iterate i
    /* If the new name already exists, then skip it. */
    If Find(ThisItems, InfoName) ~= 0 Then Iterate i
 
    /* Restore original spaces. */
    InfoName = Translate(InfoName, ' ', '/')
 
    /* Get the path to the entry. */
    Status 13 i + 1
    Path = RESULT
 
    /* Compose the directory name. */
    DumsName = Path||InfoName
 
    /* Scroll to the '.info' item. */
    ScrollToShow Translate(ThisName, ' ', '/')
 
    /* Make the directory. */
    Address COMMAND 'echo "" > "'DumsName'"'
 
    /* If the dummy could not be created, then skip deselect. */
    If RC ~= 0 Then Iterate i
 
    /* Deselect entry. */
    SelectEntry i - 1 ||' '|| 0 ||' '|| 1   
End
 
/* Final rescan to update the window pane. */
ReScan ThisWindow
 
TopText "(>-.-)/ There you go!"
Busy Off
Exit