Sub collecting

hi

i'm trying to design a button with functionality
which will recreate folder structure of "containing folder" of the file in collection

to make it simpler i can first copy file to collection as copytocoll=sub

what i have for now is

Clipboard COPYNAMES REGEXP "(\w)\:\\(.*)" "\1\\\2" "(.*\\)*(.*)" "\1" "(.*)(\\$)" "\1"
CreateFolder READAUTO=NO NAME="coll://{clip}"

this gets paths
replaces drive as a folder
and rejectes ending '/'

but it cannot create collection structure :frowning:

i haven't found it on forum despite there are similar topics but they don't cover my issue

I don't think Opus supports creating multiple nested collections in a single command (unlike normal folders).

You'd have to create each level separately.

If the the starting path always has the same number of folders in it then there's probably a shortcut to doing this, but otherwise I think it'll need a bit of VBScript or similar to split the path up and create each level separately...

i know this will be v silly question but...
how to do it
i mean i know how to write it in vb
but how to instruct DO to use vb
(the only place i've found possibility to use vb is rename module)

oh come on
it was silly - it looks like DO supports vb in advanced mode of button editor :slight_smile:

Only for rename commands. (If it works at all for anything else, it's by accident and may not behave as you'd expect!)

The simple way is to have a .VBS file with your script and tell Opus to run that (passing whatever arguments you like; e.g. the current path or selected files).

A more complex way, which avoids having the separate .VBS file, is to abuse the rename scripting feature to run a script that doesn't really rename anything.

I'd start with the simple way, then convert it to the other way once you have it working, if you don't want the .vbs file.

Within the script, you can run Opus commands (like CreateFolder) by executing dopusrt.exe (in the Opus program files dir) with the /cmd argument. e.g.:

"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /cmd CreateFolder READAUTO=no NAME="coll://Collection Name"

If you're using Opus 10, the new /col flag for dopusrt lets you create nested collections in one go.