# Macro for wildcard label assignments?

**URL:** https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276
**Category:** Help & Support
**Created:** [January 16, 2012, 7:48pm UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276 "2012-01-16T19:48:35Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Pirx](https://resource.dopus.com/user_avatar/resource.dopus.com/pirx/32/28409_2.png) [@Pirx](https://resource.dopus.com/u/Pirx)
#### Post date: [January 16, 2012, 7:48pm UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/1 "2012-01-16T19:48:35Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![kundal](https://resource.dopus.com/user_avatar/resource.dopus.com/kundal/32/24277_2.png) [@kundal](https://resource.dopus.com/u/kundal)
#### Post date: [January 17, 2012, 12:41am UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/2 "2012-01-17T00:41:17Z")

</div>

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"`

---

<div class="post-metadata">

### Author: ![Pirx](https://resource.dopus.com/user_avatar/resource.dopus.com/pirx/32/28409_2.png) [@Pirx](https://resource.dopus.com/u/Pirx)
#### Post date: [January 17, 2012, 1:43am UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/3 "2012-01-17T01:43:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Pirx](https://resource.dopus.com/user_avatar/resource.dopus.com/pirx/32/28409_2.png) [@Pirx](https://resource.dopus.com/u/Pirx)
#### Post date: [January 17, 2012, 2:09am UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/4 "2012-01-17T02:09:54Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Jon](https://resource.dopus.com/user_avatar/resource.dopus.com/jon/32/12713_2.png) [@Jon](https://resource.dopus.com/u/Jon)
#### Post date: [January 17, 2012, 3:00am UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/5 "2012-01-17T03:00:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Pirx](https://resource.dopus.com/user_avatar/resource.dopus.com/pirx/32/28409_2.png) [@Pirx](https://resource.dopus.com/u/Pirx)
#### Post date: [January 17, 2012, 3:05am UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/6 "2012-01-17T03:05:53Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![aussieboykie](https://resource.dopus.com/user_avatar/resource.dopus.com/aussieboykie/32/23729_2.png) [@aussieboykie](https://resource.dopus.com/u/aussieboykie)
#### Post date: [January 17, 2012, 3:29am UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/7 "2012-01-17T03:29:14Z")

</div>

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

```auto
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

---

<div class="post-metadata">

### Author: ![Jon](https://resource.dopus.com/user_avatar/resource.dopus.com/jon/32/12713_2.png) [@Jon](https://resource.dopus.com/u/Jon)
#### Post date: [January 17, 2012, 3:34am UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/8 "2012-01-17T03:34:11Z")

</div>

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](http://www.gpsoft.com.au/help/opus10/Documents/Labels1.htm) for more information.

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

---

<div class="post-metadata">

### Author: ![aussieboykie](https://resource.dopus.com/user_avatar/resource.dopus.com/aussieboykie/32/23729_2.png) [@aussieboykie](https://resource.dopus.com/u/aussieboykie)
#### Post date: [January 17, 2012, 3:46am UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/9 "2012-01-17T03:46:08Z")

</div>

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.. 🙂

Regards, AB

---

<div class="post-metadata">

### Author: ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)
#### Post date: [January 17, 2012, 8:50am UTC](https://resource.dopus.com/t/macro-for-wildcard-label-assignments/12276/10 "2012-01-17T08:50:07Z")

</div>

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.
