TabColor based on location

Discuss and share scripts and script files...
Post Reply
neil9090
Posts: 64
Joined: 28 Jun 2014 00:09

TabColor based on location

Post by neil9090 » 13 Aug 2019 13:07

I know it has been mentioned in a forum and will hopefully be inbuilt into XY, but here is a quick fix

Code: Select all

   // Custom Column Script (Add New Column, set column as script, add script below)

   $isSet="false";
   // \folder|backcolor|forecolor|caption
   // each location to be checked is separated by the ^ char
   $foldertabcolors="\SomeFolder|AADDFF^\Another|FFDDFF";
   
   foreach ($folder,$foldertabcolors,"^") 
   {      
     $fn=gettoken($folder, 1, "|"); 
     $backcolor=gettoken($folder, 2, "|"); 
     $forecolor=gettoken($folder, 3, "|"); 
     $caption=gettoken($folder, 4, "|"); 
          
     if strpos(<cc_path>,$fn) > 0 {
          $isSet="true";
          break;
     }         
   } // end of foreach
   
   if $isSet=="true" {
      tab("backcolor",$backcolor);
      tab("textcolor",$forecolor);
      tab("rename",$caption);      
   }
   else {
      tab("backcolor","");
      tab("textcolor","");
      tab("rename","");
   }
So this script basically looks at the current path for the tab, if the path contains e.g. \SomeFolder then background color the tab AADDFF, if path contains \Another background color tab FFDDFF, else reset the tab back to normal.

Post Reply