Modify Smart Group scripts to color the folder icons

In another part of the forum I complained because there was no way to visually distinguish Smart Groups from other groups. danzac suggested that I assign a label to each Smart Group, a step which automatically colors the folder icon. This was a great idea. As a start, I renamed the first label, the red one , to “Smart Group.”

However I create my smart groups via scripts in the Smart Group script folder plus the script “Smart Group for Comments” available at DEVONacademy: … ripts.html. I wanted these scripts to do the coloring for me. It turned out to be easy.

In each script there is a statement which creates the group:

“set theRecord to create record with {name:theWords, type:group,attached script:scriptPath}”

In the scripting dictionary I found that label number is a record attribute. Label 1 corresponds to the first label in the list, 2 to the second and so on. To color the Smart Group red, I added the phrase “label:1” to that statement above. Now it reads:

“set theRecord to create record with {name:theWords, type:group, label:1, attached script:scriptPath}”

When one of these scripts is run, the new Smart Group folder is red. Thanks, DVT folks, for making the program so adaptable.