Help on some clumsy code for dynamic collections

I want to make a special collection, that is something like a dynamic bookmark thing, containing
about 10 subcollections, which represent the changing "favorites".

So i can assign the current folders to those favorites list or "dynamic collection" with hotkeys,
let´s say per ctrl 1 to ctrl 0, to view them in a list.

The problem is, when reassigning collections, i have to clear the old contents, of course.
The following code works only until the COPY to coll://temp part. how would be the right
or some more elegant code?

@async Select ALL COPY to coll://temp Go coll://Collfavorites/1Spec Select ALL Delete REMOVECOLLECTION Go coll://temp Select ALL COPY MOVE to coll://Collfavorites/1Spec

The first 3 lines are meant to copy the contents of the current folder to the temp directory.
The next 3 lines should clear all contents of the destination subcollection.
Then the contents of coll://temp are supposed to be moved to the destination, thus clearing the
temp collection (not sure if the COPY MOVE is ok here).

I don't know if it will solve things by itself but the first thing I would do in this button (and any like it, collections or not), is remove all the Go and Select-All stuff.

The copy command can be given a wildcard pattern for the source files; it's better to use that instead of telling Opus to keep changing directories and select files.

Doing that will also save you from moving everything into a temp collection just so you can move it it into another collection later on.

Also, if you want to clear a collection it's quicker to remove it and re-create it (like the Scrap Collection Toolbar does).

Not sure what the @async is doing at the top of your button, either?

Try this:

Delete QUIET FILE="coll://Collfavorites/1Spec" CreateFolder READAUTO=no NAME="coll://Collfavorites/1Spec" COPY FILE="*" TO="coll://Collfavorites/1Spec" COPYTOCOLL=member

Well, the delete would remove the real files?! When i changed it to "Delete Removecollection", it didn´t work anymore.
Also, in your command there was a delete prompt (which i don´t want & it shouldn´t be there, using QUIET)
The @async was nothing, i only tried that, because i thought the code was executed too fast (It didn´t work).

This is basically, what the could should do: Ten hotkeys can send folders to ten collections, which are displayed
in a collection, having the description field holding the locations of the included files:

I also couldn´t manage to get the paths from the original folders being included in the collections description
fields. The usual locations fields (like seen in the screenshot on the right) only refer to the collections, but
not the contents (which makes sense, since many collections hold various locations). The reason is, that i
want to have informations in that level with no need to browse inside.

It's deleting the collection itself, not anything within the collection.

REMOVECOLLECTION is used to remove items from within collections without deleting the actual items; it isn't used on the actual collections. If you delete the entire collection it will not delete the actual things inside it.

Hmm, ok, but i have to get rid of any queries, which maybe isn´t possible, until i turn it
off globally, which i don´t want. I don´t want to delete data accidently.

Oh, ok, i wasn´t sure what happens with the contents, when deleting the collection around it.
But yeah, otherwise you wouldn´t have suggested this. :neutral_face:

Having played around with this a bit, I think this is the best way to write the command (including setting the description from the other thread):

Delete QUIET FILE="coll://Collfavorites/1Spec" CreateFolder READAUTO=no NAME="coll://Collfavorites" CreateFolder READAUTO=no NAME="coll://Collfavorites\1Spec" Copy * TO="coll://Collfavorites\1Spec" COPYTOCOLL=member SetAttr FILE="coll://Collfavorites\1Spec" DESCRIPTION={sourcepath}

However, I've noticed that sometimes Opus gets confused about whether or not the 1Spec sub-collection exists; sometimes I have to restart Opus. So I'm not sure how reliable this will be until that bug is fixed. (I've reported it.)

Leo, thank you. I tried it, & something strange happened. The 1Spec Collection disappered & when i try to make
it new, Opus says that it already exists. I wonder where it´s gone. It´s not hidden either. Is there no way to
avoid the delete query?

Those collections, by the way, are static, only the contents change (always containing stuff from one directory only).

Um... did you stop reading my post half-way through?

No, i´ve read it, of course & only wanted to confirm that there is a problem with
collections under certain circumstamces.

The quiet arg prevents the delete query. I never see one, at least.

Do you have the warning turned off in file operations? I need to leave it on, because
i use the keyboard a lot. Accidently hitting del wouldn´t be so nice. I remember, the
"quiet" thing worked well in a DOS-command, i once used in a button, Del /Q /S ..

But that won´t work on the collection stuff, i suppose.

No, delete warnings are on for me as well.

The point of the Delete QUIET argument is to prevent the warning and it definitely does so here.

Strange. I tested Delete QUIET FILE="coll://Collfavorites/2Spec" here, & it stiill asks.