Macro for wildcard label assignments?

Here's what I would like to do: I have saved a specific lister layout for working with certain kinds of files. When I am in this particular "working mode" and in the lister layout I have associated with it, I would like to color certain types of files in a certain way. As far as I understand, file and folder labels currently are applied as a global preference setting in Opus, and are not specific to a lister layout. So, to get around this limitation, my idea is to have the macro that switches to my specific working environment layout (using a simple Prefs LAYOUT="Some Layout" command) also turn on a specific set of labels. It looks like I could use something like "Properties SETLABEL=Green", say, to color selected files/folders, but in my case what I really want to do is create a wildcard label assignment (and later, when I switch back to other lister configurations, remove that wildcard assigment).

So, can this be done?

You can simply combine the Prefs LAYOUT and Properties SETLABEL commands. This example works for a dual pane layout and shows how you can also use regular Expressions with the Select command:

Prefs LAYOUT="My Layout" Properties SETLABEL=blue FILE "*.ext1" Properties SETLABEL=red FILE "*partofname*" Properties SETLABEL=blue FILE "{destpath}*.ext1" Properties SETLABEL=red FILE "{destpath}*partofname*" Select REGEXP ^[0-9]{2}\s.*\.ext2 DESELECTNOMATCH Properties SETLABEL=green Set FOCUS=Dest dopusrt /cmd Select REGEXP ^[0-9]{2}\s.*\.ext2 DESELECTNOMATCH dopusrt /cmd Properties SETLABEL=green
To clean up all Labels before switching to another Layout you can use this:

Properties SETLABEL=!reset FILE "*" Properties SETLABEL=!reset FILE "{destpath}*" Prefs LAYOUT="Another Layout"

Wow, that's bloody awesome! Thanks a lot!

Hmm, it looks like I am missing something. The code for my button now does this:

Prefs LAYOUT="Working Layout" Properties SETLABEL=OrangeTextOnly FILE "*.(000|001|7z|arj|bz2|bzip2|cab|gz|gzip|iso|jar|lha|lzh|lzma|lzma86|r00|r01|rar|swm|tar|taz|tbz|tbz2|tgz|tlz|tlzma|tpz|wim|z|zip)" Properties SETLABEL=LightCyanTextOnly FILE "*.(aux|bbl|blg|log|toc)" Properties SETLABEL=DarkCyanTextOnly FILE "*.(cls|sty)" Properties SETLABEL=LightBlueTextOnly FILE "*.(doc|docx)" Properties SETLABEL=DarkPinkTextOnly FILE "*.(ppt|pptx)" Properties SETLABEL=GreenTextOnly FILE "*.(xls|xlsx)" Properties SETLABEL=GreyTextOnly FILE "*.log" Properties SETLABEL=DarkRedTextOnly FILE "*.pdf" Properties SETLABEL=CyanTextOnly FILE "*.tex"

I checked that all of the colors are defined, but when I press that button the layout is switched, but no labels are applied. What am I doing wrong here?

The Properties SETLABEL command does not create a wildcard label assignment, unfortunately. It applies the specified label to either the currently selected files, or the files specified with the FILE argument. Specifying a wildcard pattern for the FILE argument as shown above will apply the label to any files in the current folder that match the wildcard, but it doesn't create a global wildcard assignment using that pattern.

Ahh, that's what I feared, so what I wanted can't be done right now. Not a huge deal, I'll just keep my labels the same across all layouts. That may be a good idea anyway. Thanks for the clarification!

I notice that the following SETLABEL command, which was created using the drop downs in the Advanced dialog, does not work.

Properties SETLABEL=Blue,Bold FILE *.png

Is this a bug or a limitation - i.e. you can have colour OR bold, but not both?

Regards, AB

The value for the SETLABEL argument is the name of the label to assign, not the characteristics of the label itself. Labels have to be pre-defined through Preferences - see gpsoft.com.au/help/opus10/Do ... abels1.htm for more information.

It would probably work if you created a label called "Blue,Bold" though :slight_smile:

Fair enough Jon. The fact that the Advanced dialog allowed the combination to be created suggested that additive application of existing defined labels might be an option but on reflection, whilst Blue,Bold is a reasonable request things like Red,Blue would not make a lot of sense.. :slight_smile:

Regards, AB

The command editor only knows how to create the right syntax; it isn't clever enough to understand the semantics of every command and argument, or to prevent you from combining arguments which don't work together.

So you can use the editor menus to build up a command that is in the right format but which doesn't make sense or do anything useful.