Find all tags

Discuss and share scripts and script files...
highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Find all tags

Post by highend »

All files that appear in the window are either tagged, labelled or have a comment.

Code: Select all

    $lb = "<crlf>";
    $items = "";
    foreach($item, "<get SelectedItemsPathNames <crlf>>", $lb) {
        if (exists($item) == 1) { $items = $items . $item . report("?{Tags}?{Label}?{Comment}", $item) . $lb; }
        else { $items = $items . folderreport("files:{fullname}?{Tags}?{Label}?{Comment}", "r", $item, "r", , $lb) . $lb; }
    }

    $tagged = regexmatches($items, ".*?\?\w+\?\?$", $lb);
    $labelled = regexmatches($items, ".*?\?\?\w+\?$", $lb);
    $commented = regexmatches($items, ".*?\?\?\?\w+$", $lb);
    $items = regexmatches(formatlist($tagged . $lb . $labelled . $lb . $commented, "dents", $lb), "^.*?(?=\?)", $lb);

    if ($items) {
        if (confirm("Tags/Labels/Comments present. View?")) { text $items; }
    } else { status "Selected items neither have a tag, label or comment", , "stop"; }
One of my scripts helped you out? Please donate via Paypal

Norn
Posts: 417
Joined: 24 Oct 2021 16:10

Re: Find all tags

Post by Norn »

:whistle:
Last edited by Norn on 11 Feb 2022 12:48, edited 2 times in total.
Win10, Win11 @100% 2560x1440 22H2

Norn
Posts: 417
Joined: 24 Oct 2021 16:10

Re: Find all tags

Post by Norn »

Find Items by Tags or Labels List | Add Tags or Labels by List | Classification of the tags.
New version not tested:

Code: Select all

//@Function : Find Items by Tags or Labels List
//@Created : 2022-02-05
//@Modified: 2022-07-19
//@Version : 3.15

    // Handle .ini file
    $iniFile = self("path") . "\" . self("base") . "CustomTagsList" . ".ini";

    // Write .ini file if missing
    if (exists($iniFile) != 1) {
        $iniContent = <<<'>>>'


//Tags List
[Custom Labels List]
Custom Labels List=Red, Orange, Yellow, Green, Blue, Purple, Grey

[Custom Tags List 1]
Custom Tags List 1=

[Custom Tags List 2]
Custom Tags List 2=

[Custom Tags List 3]
Custom Tags List 3=

[Custom Tags List 4]
Custom Tags List 4=

[Custom Tags List 5]
Custom Tags List 5=

[Custom Tags List 6]
Custom Tags List 6=

[Custom Tags List 7]
Custom Tags List 7=

[Custom Tags List 8]
Custom Tags List 8=

[Custom Tags List 9]
Custom Tags List 9=

[Custom Tags List 10]
Custom Tags List 10=

; The last query you've used
LastQuery=
        >>>;
        writefile($iniFile, $iniContent, , "tu");
    }





//Get tags
                                   $taglist = formatlist(taglist(), "t", ", ");        //Get taglist
								   $curitemTag = tagitems("tags", , "<curitem>", 1);   //The tag(s) of the current item
								   $selItemsTag = tagitems("tags", , , 1);             //Tag(s) of selected items
								   $selItemsTag = formatlist($selItemsTag, "sd");      //Remove duplicate tags of $selItemsTag
								   
//$taglist - $curitemTag = $newtaglist
                                   $newtaglist = "";
                                   foreach($taglist1, $taglist, ", ", "e") {
								      $case = "";
								      foreach($curitemTag1, $curitemTag, ", ", "e") {
									     if($taglist1 == $curitemTag1) {$case = "1";}
										 }
									  if($case == "") {$newtaglist .= "$taglist1" . ", ";}
									  }
									
								   $newtaglist2 = substr($newtaglist, 0, -2);
								   
//If $sleItemsTag contains empty tag(s) / Untagged item(s), set $case2 = 1, then break
                                   foreach($selItemsTag1, $selItemsTag, "|") {
								      if($selItemsTag1 == "") {$case2 = "1"; break;}
								      }
									  
								   switch($case2) {                                    //Switch $case2
								      case "1":
									    $taglist2 = $taglist;                          //Show only list of tags
										break;
									  default:
									    //Set $newCuritemTag separated by ", +"
								        $newCuritemTag = "";
								        foreach($curitemTag11, $curitemTag, ", ") {
								           $newCuritemTag .= "+" . "$curitemTag11" . ", ";
									       }
								      $taglist2 = "$newCuritemTag" . "$newtaglist2";   //Combination $newCuritemTag & $newtaglist2
								      }
									  
									  
									  
//Menu								   
                                   $C = "<Find by Labels List>, <Work>, <Custom Tags List 2>, <Custom Tags List 3>, <Custom Tags List 4>, <Custom Tags List 5>, <Custom Tags List 6>, <Custom Tags List 7>, <Custom Tags List 8>, <Custom Tags List 9>, <Custom Tags List 10>, ->Remove Tags->, <Copy Tags>, ->Remove Labels->, 丨Red丨, 丨Orange丨, 丨Yellow丨, 丨Green丨, 丨Blue丨, 丨Purple丨, 丨Grey丨";								   
                                   $Where = "%computer%";
//window 
                                   $data=inputselect("Select", "$C, $taglist2",", " ,3:=4+64+4096, "cancel", 500, 665, "Find Items by Tags or Labels List", , ":qns");						 

//Get Custom Labels
								   $CLabelsL = getkey("Custom Labels List",     "Custom Labels List", $iniFile);


//Cancel
  	    if $data == "cancel" {end 1==1}; 		

//Remove Tags
        if(regexmatches($data, "->Remove Tags->")) {tag , , 1, 2; end 1==1;};

//Copy Tags
        $T = formatlist(replace($taglist, ", ", <crlf>), "e", <crlf>);
        if(regexmatches($data, "<Copy Tags>")) {$Tagslist = input("Tags List:", , $T, "m", $taglist, 500, 665); end 1==1; };		

//Remove Labels
        if(regexmatches($data, "->Remove Labels->")) {tag; end 1==1;};
		
//Labels

		if(regexmatches($data, "丨Red丨")) {$data = replace($data, "丨",""); goto "%computer%?lbl:$data /r"; end 1==1};
		if(regexmatches($data, "丨Orange丨")) {$data = replace($data, "丨",""); goto "%computer%?lbl:$data /r"; end 1==1;};
		if(regexmatches($data, "丨Yellow丨")) {$data = replace($data, "丨",""); goto "%computer%?lbl:$data /r"; end 1==1;};
		if(regexmatches($data, "丨Green丨")) {$data = replace($data, "丨",""); goto "%computer%?lbl:$data /r"; end 1==1;};
		if(regexmatches($data, "丨Blue丨")) {$data = replace($data, "丨",""); goto "%computer%?lbl:$data /r"; end 1==1;};
		if(regexmatches($data, "丨Purple丨")) {$data = replace($data, "丨",""); goto "%computer%?lbl:$data /r"; end 1==1;};
		if(regexmatches($data, "丨Grey丨")) {$data = replace($data, "丨",""); goto "%computer%?lbl:$data /r"; end 1==1;};				 		  

        if(regexmatches($data, "<Find by Labels List>"))
          {		  
	       $Labels=inputselect("Select", "<Edit Custom Labels List>, <Search Here>, $CLabelsL", ", " ,3:=2+4096, "cancel", 500, 665, "Fing Items by Labels List", , ":labels");
		   $Labels=replace($Labels,"<Find by Labels List>",);
   		   if(regexmatches($Labels, "<Search Here>")) {$Where = "<curpath>"; $Labels = replace("$Labels","<Search Here>","")};
		 if ($Labels == "cancel") {end 1==1;};
         if ($Labels != <Edit Custom Labels List>) {$Labels = replace($Labels,", "," | "); goto "$Where?lbl:$Labels /r"; end 1==1};	
		 if $Labels == "<Edit Custom Labels List>"	 
           {
		   	$CLabelsL = getkey("Custom Labels List",     "Custom Labels List", $iniFile);  	
            $CLabelsL = formatlist(replace($CLabelsL, ", ", <crlf>), "e", <crlf>);
            $CustomLabelsList = input("<Edit Custom Labels List>", , $CLabelsL, "m", $CLabelsL, 500, 665);	
		    $CustomLabelsList = replace($CustomLabelsList, <crlf>, ", ");
	        setkey $CustomLabelsList, "Custom Labels List", "Custom Labels List", $iniFile;	status "Custom Labels List Saved"; end 1==1;
           }
          }


       		  
//Tags->
//tagitem(s)		
		if(!regexmatches($data, "<Work>") && !regexmatches($data, "<Custom Tags List 2>") && !regexmatches($data, "<Custom Tags List 3>") && !regexmatches($data, "<Custom Tags List 4>") && !regexmatches($data, "<Custom Tags List 5>") && !regexmatches($data, "<Custom Tags List 6>") && !regexmatches($data, "<Custom Tags List 7>") && !regexmatches($data, "<Custom Tags List 8>") && !regexmatches($data, "<Custom Tags List 9>") && !regexmatches($data, "<Custom Tags List 10>")) {goto "%computer%?tags: $data /r"; end 1==1;};




//$taglist3
								   $taglist3 = replace($taglist,", ", "|");								   
//CustomTagsList 1		
        if(regexmatches($data, "<Work>")) 		
		  {	
	         $CTL1 = getkey("Custom Tags List 1",     "Custom Tags List 1", $iniFile);
			 			 		 			 
//CTL1 - taggedlist = $CTL1B								   								   								  								   								   							   							   
								   $CTL1B = replacelist("$CTL1", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL1B to ", "								   
                                   $CTL1B = replace("$CTL1B", ", ", ",");									   
								   $CTL1B = replace("$CTL1B", ",,", ",");	
								   $CTL1B = replace("$CTL1B", ",,", ",");
								   $CTL1B = replace("$CTL1B", ",", ", ");
								   
//combination $CTL1B								   
								   $CTL1B = ", " . "$CTL1B";
								   $CTL1B = replace("$CTL1B", ", , ", ", ");
//If $CTL1B = empty, $CTL1B = empty																
								   if $CTL1B == "+" {$CTL1B = ""};
		     $CustomTagsListC1=inputselect("Select<crlf>Custom Tags List 1", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL1B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC1 == "cancel" {end 1==1};

//taglist - CTL1 = $AdTags			
                                   $CTL1C = replace($CTL1,", ", "|");				   								   								  								   								   							   							   
								   $AddTags = replacelist("$taglist", "$CTL1C|, ", "", "|", 0, 1);	

//replace $AddTags to ", "								   
                                   $AddTags = replace("$AddTags", ", ", ",");									   
								   $AddTags = replace("$AddTags", ",,", ",");	
								   $AddTags = replace("$AddTags", ",,", ",");
								   $AddTags = replace("$AddTags", ",", ", ");								   

//Add Tags to Custom Tags List 1          
			    if(regexmatches($CustomTagsListC1, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text1=inputselect("Select<crlf>Add Tags to Custom Tags List 1", "$AddTags", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 1", , ":qns");
	              if $text1 == "cancel" {end 1==1};
				  $text1 = "$text1, ";
				  if $text1 == ", " {$text1 = ""};		  
                  setkey "$text1$CTL1", "Custom Tags List 1", "Custom Tags List 1", $iniFile; status "Added to <Work>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 1										
                if(regexmatches($CustomTagsListC1, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL1 = formatlist(replace($CTL1, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD1 = input("Edit Custom Tags List 1", , $CTL1, "m", $CTL1, 500, 665);
   		          $CustomTagsListD1 = replace($CustomTagsListD1, <crlf>, ", ");
	              setkey $CustomTagsListD1, "Custom Tags List 1", "Custom Tags List 1", $iniFile; status "Done."; end 1==1;
			      }			 	
                if(regexmatches($CustomTagsListC1, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC1 = replace("$CustomTagsListC1","<Search Here>","")};				  
				if(!regexmatches($CustomTagsListC1, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC1, "<Edit Current Tags List>"))) {$CustomTagsListC1 = replace($CustomTagsListC1,", ","|"); $CustomTagsListC1 = "$CustomTagsListC1"; goto "$Where?tags: $CustomTagsListC1 /r"; end 1==1;};		   
		  }	





//CustomTagsList 2		
        if(regexmatches($data, "<Custom Tags List 2>")) 		
		  {	
	         $CTL2 = getkey("Custom Tags List 2",     "Custom Tags List 2", $iniFile);
			 			 		 			 
//CTL2 - taggedlist = $CTL2B								   								   								  								   								   							   							   
								   $CTL2B = replacelist("$CTL2", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL2B to ", "								   
                                   $CTL2B = replace("$CTL2B", ", ", ",");									   
								   $CTL2B = replace("$CTL2B", ",,", ",");	
								   $CTL2B = replace("$CTL2B", ",,", ",");
								   $CTL2B = replace("$CTL2B", ",", ", ");
								   
//combination $CTL2B								   
								   $CTL2B = ", " . "$CTL2B";

//If $CTL2B = empty, $CTL2B = empty																
								   if $CTL2B == "+" {$CTL2B = ""};
		     $CustomTagsListC2=inputselect("Select<crlf>Custom Tags List 2", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL2B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC2 == "cancel" {end 1==1};

//taglist - CTL2 = $AdTags2			
                                   $CTL2C = replace($CTL2,", ", "|");				   								   								  								   								   							   							   
								   $AddTags2 = replacelist("$taglist", "$CTL2C|, ", "", "|", 0, 1);	

//replace $AddTags2 to ", "								   
                                   $AddTags2 = replace("$AddTags2", ", ", ",");									   
								   $AddTags2 = replace("$AddTags2", ",,", ",");	
								   $AddTags2 = replace("$AddTags2", ",,", ",");
								   $AddTags2 = replace("$AddTags2", ",", ", ");								   

//Add Tags to Custom Tags List 2         
			    if(regexmatches($CustomTagsListC2, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text2=inputselect("Select<crlf>Add Tags to Custom Tags List 2", "$AddTags2", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 1", , ":qns");
	              if $text2 == "cancel" {end 1==1};
				  $text2 = "$text2, ";
				  if $text2 == ", " {$text2 = ""};					  
                  setkey "$text2$CTL2", "Custom Tags List 2", "Custom Tags List 2", $iniFile; status "Added to <Custom Tags List 2>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 2										
                if(regexmatches($CustomTagsListC2, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL2 = formatlist(replace($CTL2, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD2 = input("Edit Custom Tags List 2", , $CTL2, "m", $CTL2, 500, 665);
   		          $CustomTagsListD2 = replace($CustomTagsListD2, <crlf>, ", ");
	              setkey $CustomTagsListD2, "Custom Tags List 2", "Custom Tags List 2", $iniFile; status "Done."; end 1==1;
			      }			 
                if(regexmatches($CustomTagsListC2, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC2 = replace("$CustomTagsListC2","<Search Here>","")};				  
				if(!regexmatches($CustomTagsListC2, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC2, "<Edit Current Tags List>"))) {$CustomTagsListC2 = replace($CustomTagsListC2,", ","|"); $CustomTagsListC2 = "$CustomTagsListC2"; goto "$Where?tags: $CustomTagsListC2 /r"; end 1==1;};		   
		  }	





//CustomTagsList 3		
        if(regexmatches($data, "<Custom Tags List 3>")) 		
		  {	
	         $CTL3 = getkey("Custom Tags List 3",     "Custom Tags List 3", $iniFile);
			 			 		 			 
//CTL3 - taggedlist = $CTL3B								   								   								  								   								   							   							   
								   $CTL3B = replacelist("$CTL3", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL3B to ", "								   
                                   $CTL3B = replace("$CTL3B", ", ", ",");									   
								   $CTL3B = replace("$CTL3B", ",,", ",");	
								   $CTL3B = replace("$CTL3B", ",,", ",");
								   $CTL3B = replace("$CTL3B", ",", ", ");
								   
//combination $CTL3B								   
								   $CTL3B = ", " . "$CTL3B";
								   $CTL3B = replace("$CTL3B", ", , ", ", ");
//If $CTL3B = empty, $CTL3B = empty																
								   if $CTL3B == "+" {$CTL3B = ""};
		     $CustomTagsListC3=inputselect("Select<crlf>Custom Tags List 3", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL3B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC3 == "cancel" {end 1==1};

//taglist - CTL3 = $AddTags3			
                                   $CTL3C = replace($CTL3,", ", "|");				   								   								  								   								   							   							   
								   $AddTags3 = replacelist("$taglist", "$CTL3C|, ", "", "|", 0, 1);	

//replace $AddTags3 to ", "								   
                                   $AddTags3 = replace("$AddTags3", ", ", ",");									   
								   $AddTags3 = replace("$AddTags3", ",,", ",");	
								   $AddTags3 = replace("$AddTags3", ",,", ",");
								   $AddTags3 = replace("$AddTags3", ",", ", ");								   

//Add Tags to Custom Tags List 3          
			    if(regexmatches($CustomTagsListC3, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text3=inputselect("Select<crlf>Add Tags to Custom Tags List 3", "$AddTags3", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 3", , ":qns");
	              if $text3 == "cancel" {end 1==1};	
				  $text3 = "$text3, ";
				  if $text3 == ", " {$text3 = ""};	                  				  
                  setkey "$text3$CTL3", "Custom Tags List 3", "Custom Tags List 3", $iniFile; status "Added to <Custom Tags List 3>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 3										
                if(regexmatches($CustomTagsListC3, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL3 = formatlist(replace($CTL3, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD3 = input("Edit Custom Tags List 3", , $CTL3, "m", $CTL3, 500, 665);
   		          $CustomTagsListD3 = replace($CustomTagsListD3, <crlf>, ", ");
	              setkey $CustomTagsListD3, "Custom Tags List 3", "Custom Tags List 3", $iniFile; status "Done."; end 1==1;
			      }		
                if(regexmatches($CustomTagsListC3, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC3 = replace("$CustomTagsListC3","<Search Here>","")};				  
				if(!regexmatches($CustomTagsListC3, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC3, "<Edit Current Tags List>"))) {$CustomTagsListC3 = replace($CustomTagsListC3,", ","|"); $CustomTagsListC3 = "$CustomTagsListC3"; goto "$Where?tags: $CustomTagsListC3 /r"; end 1==1;};		   
		  }	
		  
		  
		  
		  
		  
//CustomTagsList 4		
        if(regexmatches($data, "<Custom Tags List 4>")) 		
		  {	
	         $CTL4 = getkey("Custom Tags List 4",     "Custom Tags List 4", $iniFile);
			 			 		 			 
//CTL4 - taggedlist = $CTL4B								   								   								  								   								   							   							   
								   $CTL4B = replacelist("$CTL4", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL4B to ", "								   
                                   $CTL4B = replace("$CTL4B", ", ", ",");									   
								   $CTL4B = replace("$CTL4B", ",,", ",");	
								   $CTL4B = replace("$CTL4B", ",,", ",");
								   $CTL4B = replace("$CTL4B", ",", ", ");
								   
//combination $CTL4B								   
								   $CTL4B = ", " . "$CTL4B";

//If $CTL4B = empty, $CTL4B = empty																
								   if $CTL4B == "+" {$CTL4B = ""};
		     $CustomTagsListC4=inputselect("Select<crlf>Custom Tags List 4", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL4B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC4 == "cancel" {end 1==1};

//taglist - CTL4 = $AdTags4			
                                   $CTL4C = replace($CTL4,", ", "|");				   								   								  								   								   							   							   
								   $AddTags4 = replacelist("$taglist", "$CTL4C|, ", "", "|", 0, 1);	

//replace $AddTags4 to ", "								   
                                   $AddTags4 = replace("$AddTags4", ", ", ",");									   
								   $AddTags4 = replace("$AddTags4", ",,", ",");	
								   $AddTags4 = replace("$AddTags4", ",,", ",");
								   $AddTags4 = replace("$AddTags4", ",", ", ");								   

//Add Tags to Custom Tags List 4          
			    if(regexmatches($CustomTagsListC4, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text4=inputselect("Select<crlf>Add Tags to Custom Tags List 4", "$AddTags4", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 4", , ":qns");
	              if $text4 == "cancel" {end 1==1};	
				  $text4 = "$text4, ";
				  if $text4 == ", " {$text4 = ""};					  
                  setkey "$text4$CTL4", "Custom Tags List 4", "Custom Tags List 4", $iniFile; status "Added to <Custom Tags List 4>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 4										
                if(regexmatches($CustomTagsListC4, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL4 = formatlist(replace($CTL4, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD4 = input("Edit Custom Tags List 4", , $CTL4, "m", $CTL4, 500, 665);
   		          $CustomTagsListD4 = replace($CustomTagsListD4, <crlf>, ", ");
	              setkey $CustomTagsListD4, "Custom Tags List 4", "Custom Tags List 4", $iniFile; status "Done."; end 1==1;
			      }			
                if(regexmatches($CustomTagsListC4, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC4 = replace("$CustomTagsListC4","<Search Here>","")}; 				  
				if(!regexmatches($CustomTagsListC4, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC4, "<Edit Current Tags List>"))) {$CustomTagsListC4 = replace($CustomTagsListC4,", ","|"); $CustomTagsListC4 = "$CustomTagsListC4"; goto "$Where?tags: $CustomTagsListC4 /r"; end 1==1;};		   
		  }	




//CustomTagsList 5		
        if(regexmatches($data, "<Custom Tags List 5>")) 		
		  {	
	         $CTL5 = getkey("Custom Tags List 5",     "Custom Tags List 5", $iniFile);
			 			 		 			 
//CTL5 - taggedlist = $CTL5B								   								   								  								   								   							   							   
								   $CTL5B = replacelist("$CTL5", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL5B to ", "								   
                                   $CTL5B = replace("$CTL5B", ", ", ",");									   
								   $CTL5B = replace("$CTL5B", ",,", ",");	
								   $CTL5B = replace("$CTL5B", ",,", ",");
								   $CTL5B = replace("$CTL5B", ",", ", ");
								   
//combination $CTL5B								   
								   $CTL5B = ", " . "$CTL5B";
								   $CTL5B = replace("$CTL5B", ", , ", ", ");
//If $CTL5B = empty, $CTL5B = empty																
								   if $CTL5B == "+" {$CTL5B = ""};
		     $CustomTagsListC5=inputselect("Select<crlf>Custom Tags List 5", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL5B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC5 == "cancel" {end 1==1};

//taglist - CTL5 = $AdTags5			
                                   $CTL5C = replace($CTL5,", ", "|");				   								   								  								   								   							   							   
								   $AddTags5 = replacelist("$taglist", "$CTL5C|, ", "", "|", 0, 1);	

//replace $AddTags5 to ", "								   
                                   $AddTags5 = replace("$AddTags5", ", ", ",");									   
								   $AddTags5 = replace("$AddTags5", ",,", ",");	
								   $AddTags5 = replace("$AddTags5", ",,", ",");
								   $AddTags5 = replace("$AddTags5", ",", ", ");								   

//Add Tags to Custom Tags List 5          
			    if(regexmatches($CustomTagsListC5, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text5=inputselect("Select<crlf>Add Tags to Custom Tags List 5", "$AddTags5", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 5", , ":qns");
	              if $text5 == "cancel" {end 1==1};		
				  $text5 = "$text5, ";
				  if $text5 == ", " {$text5 = ""};					  
                  setkey "$text5$CTL5", "Custom Tags List 5", "Custom Tags List 5", $iniFile; status "Added to <Custom Tags List 5>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 5										
                if(regexmatches($CustomTagsListC5, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL5 = formatlist(replace($CTL5, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD5 = input("Edit Custom Tags List 5", , $CTL5, "m", $CTL5, 500, 665);
   		          $CustomTagsListD5 = replace($CustomTagsListD5, <crlf>, ", ");
	              setkey $CustomTagsListD5, "Custom Tags List 5", "Custom Tags List 5", $iniFile; status "Done."; end 1==1;
			      }			 	
                if(regexmatches($CustomTagsListC5, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC5 = replace("$CustomTagsListC5","<Search Here>","")};				  
				if(!regexmatches($CustomTagsListC5, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC5, "<Edit Current Tags List>"))) {$CustomTagsListC5 = replace($CustomTagsListC5,", ","|"); $CustomTagsListC5 = "$CustomTagsListC5"; goto "$Where?tags: $CustomTagsListC5 /r"; end 1==1;};		   
		  }	




//CustomTagsList 6		
        if(regexmatches($data, "<Custom Tags List 6>")) 		
		  {	
	         $CTL6 = getkey("Custom Tags List 6",     "Custom Tags List 6", $iniFile);
			 			 		 			 
//CTL6 - taggedlist = $CTL6B								   								   								  								   								   							   							   
								   $CTL6B = replacelist("$CTL6", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL6B to ", "								   
                                   $CTL6B = replace("$CTL6B", ", ", ",");									   
								   $CTL6B = replace("$CTL6B", ",,", ",");	
								   $CTL6B = replace("$CTL6B", ",,", ",");
								   $CTL6B = replace("$CTL6B", ",", ", ");
								   
//combination $CTL6B								   
								   $CTL6B = ", " . "$CTL6B";
								   $CTL6B = replace("$CTL6B", ", , ", ", ");
//If $CTL6B = empty, $CTL6B = empty																
								   if $CTL6B == "+" {$CTL6B = ""};
		     $CustomTagsListC6=inputselect("Select<crlf>Custom Tags List 6", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL6B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC6 == "cancel" {end 1==1};

//taglist - CTL6 = $AdTags6			
                                   $CTL6C = replace($CTL6,", ", "|");				   								   								  								   								   							   							   
								   $AddTags6 = replacelist("$taglist", "$CTL6C|, ", "", "|", 0, 1);	

//replace $AddTags6 to ", "								   
                                   $AddTags6 = replace("$AddTags6", ", ", ",");									   
								   $AddTags6 = replace("$AddTags6", ",,", ",");	
								   $AddTags6 = replace("$AddTags6", ",,", ",");
								   $AddTags6 = replace("$AddTags6", ",", ", ");								   

//Add Tags to Custom Tags List 6          
			    if(regexmatches($CustomTagsListC6, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text6=inputselect("Select<crlf>Add Tags to Custom Tags List 6", "$AddTags6", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 6", , ":qns");
	              if $text6 == "cancel" {end 1==1};
				  $text6 = "$text6, ";
				  if $text6 == ", " {$text6 = ""};					  
                  setkey "$text6$CTL6", "Custom Tags List 6", "Custom Tags List 6", $iniFile; status "Added to <Custom Tags List 6>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 6										
                if(regexmatches($CustomTagsListC6, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL6 = formatlist(replace($CTL6, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD6 = input("Edit Custom Tags List 6", , $CTL6, "m", $CTL6, 500, 665);
   		          $CustomTagsListD6 = replace($CustomTagsListD6, <crlf>, ", ");
	              setkey $CustomTagsListD6, "Custom Tags List 6", "Custom Tags List 6", $iniFile; status "Done."; end 1==1;
			      }			 
                if(regexmatches($CustomTagsListC6, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC6 = replace("$CustomTagsListC6","<Search Here>","")};				  
				if(!regexmatches($CustomTagsListC6, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC6, "<Edit Current Tags List>"))) {$CustomTagsListC6 = replace($CustomTagsListC6,", ","|"); $CustomTagsListC6 = "$CustomTagsListC6"; goto "$Where?tags: $CustomTagsListC6 /r"; end 1==1;};		   
		  }	




//CustomTagsList 7		
        if(regexmatches($data, "<Custom Tags List 7>")) 		
		  {	
	         $CTL7 = getkey("Custom Tags List 7",     "Custom Tags List 7", $iniFile);
			 			 		 			 
//CTL7 - taggedlist = $CTL7B								   								   								  								   								   							   							   
								   $CTL7B = replacelist("$CTL7", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL7B to ", "								   
                                   $CTL7B = replace("$CTL7B", ", ", ",");									   
								   $CTL7B = replace("$CTL7B", ",,", ",");	
								   $CTL7B = replace("$CTL7B", ",,", ",");
								   $CTL7B = replace("$CTL7B", ",", ", ");
								   
//combination $CTL7B								   
								   $CTL7B = ", " . "$CTL7B";

//If $CTL7B = empty, $CTL7B = empty																
								   if $CTL7B == "+" {$CTL7B = ""};
		     $CustomTagsListC7=inputselect("Select<crlf>Custom Tags List 7", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL7B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC7 == "cancel" {end 1==1};

//taglist - CTL7 = $AdTags7			
                                   $CTL7C = replace($CTL7,", ", "|");				   								   								  								   								   							   							   
								   $AddTags7 = replacelist("$taglist", "$CTL7C|, ", "", "|", 0, 1);	

//replace $AddTags7 to ", "								   
                                   $AddTags7 = replace("$AddTags7", ", ", ",");									   
								   $AddTags7 = replace("$AddTags7", ",,", ",");	
								   $AddTags7 = replace("$AddTags7", ",,", ",");
								   $AddTags7 = replace("$AddTags7", ",", ", ");								   

//Add Tags to Custom Tags List 7          
			    if(regexmatches($CustomTagsListC7, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text7=inputselect("Select<crlf>Add Tags to Custom Tags List 7", "$AddTags7", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 7", , ":qns");
	              if $text7 == "cancel" {end 1==1};	
				  $text7 = "$text7, ";
				  if $text7 == ", " {$text7 = ""};					  
                  setkey "$text7$CTL7", "Custom Tags List 7", "Custom Tags List 7", $iniFile; status "Added to <Custom Tags List 7>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 7										
                if(regexmatches($CustomTagsListC7, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL7 = formatlist(replace($CTL7, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD7 = input("Edit Custom Tags List 7", , $CTL7, "m", $CTL7, 500, 665);
   		          $CustomTagsListD7 = replace($CustomTagsListD7, <crlf>, ", ");
	              setkey $CustomTagsListD7, "Custom Tags List 7", "Custom Tags List 7", $iniFile; status "Done."; end 1==1;
			      }			 		
                if(regexmatches($CustomTagsListC7, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC7 = replace("$CustomTagsListC7","<Search Here>","")};				  
				if(!regexmatches($CustomTagsListC7, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC7, "<Edit Current Tags List>"))) {$CustomTagsListC7 = replace($CustomTagsListC7,", ","|"); $CustomTagsListC7 = "$CustomTagsListC7"; goto "$Where?tags: $CustomTagsListC7 /r"; end 1==1;};		   
		  }	




//CustomTagsList 8		
        if(regexmatches($data, "<Custom Tags List 8>")) 		
		  {	
	         $CTL8 = getkey("Custom Tags List 8",     "Custom Tags List 8", $iniFile);
			 			 		 			 
//CTL8 - taggedlist = $CTL8B								   								   								  								   								   							   							   
								   $CTL8B = replacelist("$CTL8", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL8B to ", "								   
                                   $CTL8B = replace("$CTL8B", ", ", ",");									   
								   $CTL8B = replace("$CTL8B", ",,", ",");	
								   $CTL8B = replace("$CTL8B", ",,", ",");
								   $CTL8B = replace("$CTL8B", ",", ", ");
								   
//combination $CTL8B								   
								   $CTL8B = ", " . "$CTL8B";
								   $CTL8B = replace("$CTL8B", ", , ", ", ");
//If $CTL8B = empty, $CTL8B = empty																
								   if $CTL8B == "+" {$CTL8B = ""};
		     $CustomTagsListC8=inputselect("Select<crlf>Custom Tags List 8", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL8B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC8 == "cancel" {end 1==1};

//taglist - CTL8 = $AdTags8			
                                   $CTL8C = replace($CTL8,", ", "|");				   								   								  								   								   							   							   
								   $AddTags8 = replacelist("$taglist", "$CTL8C|, ", "", "|", 0, 1);	

//replace $AddTags8 to ", "								   
                                   $AddTags8 = replace("$AddTags8", ", ", ",");									   
								   $AddTags8 = replace("$AddTags8", ",,", ",");	
								   $AddTags8 = replace("$AddTags8", ",,", ",");
								   $AddTags8 = replace("$AddTags8", ",", ", ");								   

//Add Tags to Custom Tags List 8          
			    if(regexmatches($CustomTagsListC8, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text8=inputselect("Select<crlf>Add Tags to Custom Tags List 8", "$AddTags8", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 8", , ":qns");
	              if $text8 == "cancel" {end 1==1};	
				  $text8 = "$text8, ";
				  if $text8 == ", " {$text8 = ""};					  
                  setkey "$text8$CTL8", "Custom Tags List 8", "Custom Tags List 8", $iniFile; status "Added to <Custom Tags List 8>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 8										
                if(regexmatches($CustomTagsListC8, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL8 = formatlist(replace($CTL8, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD8 = input("Edit Custom Tags List 8", , $CTL8, "m", $CTL8, 500, 665);
   		          $CustomTagsListD8 = replace($CustomTagsListD8, <crlf>, ", ");
	              setkey $CustomTagsListD8, "Custom Tags List 8", "Custom Tags List 8", $iniFile; status "Done."; end 1==1;
			      }			 
                if(regexmatches($CustomTagsListC8, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC8 = replace("$CustomTagsListC8","<Search Here>","")};				  
				if(!regexmatches($CustomTagsListC8, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC8, "<Edit Current Tags List>"))) {$CustomTagsListC8 = replace($CustomTagsListC8,", ","|"); $CustomTagsListC8 = "$CustomTagsListC8"; goto "$Where?tags: $CustomTagsListC8 /r"; end 1==1;};		   
		  }	




//CustomTagsList 9		
        if(regexmatches($data, "<Custom Tags List 9>")) 		
		  {	
	         $CTL9 = getkey("Custom Tags List 9",     "Custom Tags List 9", $iniFile);
			 			 		 			 
//CTL9 - taggedlist = $CTL9B								   								   								  								   								   							   							   
								   $CTL9B = replacelist("$CTL9", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL9B to ", "								   
                                   $CTL9B = replace("$CTL9B", ", ", ",");									   
								   $CTL9B = replace("$CTL9B", ",,", ",");	
								   $CTL9B = replace("$CTL9B", ",,", ",");
								   $CTL9B = replace("$CTL9B", ",", ", ");
								   
//combination $CTL9B								   
								   $CTL9B = ", " . "$CTL9B";

//If $CTL9B = empty, $CTL9B = empty																
								   if $CTL9B == "+" {$CTL9B = ""};
		     $CustomTagsListC9=inputselect("Select<crlf>Custom Tags List 9", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL9B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC9 == "cancel" {end 1==1};

//taglist - CTL9 = $AdTags9			
                                   $CTL9C = replace($CTL9,", ", "|");				   								   								  								   								   							   							   
								   $AddTags9 = replacelist("$taglist", "$CTL9C|, ", "", "|", 0, 1);	

//replace $AddTags9 to ", "								   
                                   $AddTags9 = replace("$AddTags9", ", ", ",");									   
								   $AddTags9 = replace("$AddTags9", ",,", ",");	
								   $AddTags9 = replace("$AddTags9", ",,", ",");
								   $AddTags9 = replace("$AddTags9", ",", ", ");								   

//Add Tags to Custom Tags List 9          
			    if(regexmatches($CustomTagsListC9, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text9=inputselect("Select<crlf>Add Tags to Custom Tags List 9", "$AddTags9", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 9", , ":qns");
	              if $text9 == "cancel" {end 1==1};
				  $text9 = "$text9, ";
				  if $text9 == ", " {$text9 = ""};					  
                  setkey "$text9$CTL9", "Custom Tags List 9", "Custom Tags List 9", $iniFile; status "Added to <Custom Tags List 9>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 9										
                if(regexmatches($CustomTagsListC9, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL9 = formatlist(replace($CTL9, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD9 = input("Edit Custom Tags List 9", , $CTL9, "m", $CTL9, 500, 665);
   		          $CustomTagsListD9 = replace($CustomTagsListD9, <crlf>, ", ");
	              setkey $CustomTagsListD9, "Custom Tags List 9", "Custom Tags List 9", $iniFile; status "Done."; end 1==1;
			      }		
                if(regexmatches($CustomTagsListC9, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC9 = replace("$CustomTagsListC9","<Search Here>","")};				  
				if(!regexmatches($CustomTagsListC9, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC9, "<Edit Current Tags List>"))) {$CustomTagsListC9 = replace($CustomTagsListC9,", ","|"); $CustomTagsListC9 = "$CustomTagsListC9"; goto "$Where?tags: $CustomTagsListC9 /r"; end 1==1;};		   
		  }	




//CustomTagsList 10		
        if(regexmatches($data, "<Custom Tags List 10>")) 		
		  {	
	         $CTL10 = getkey("Custom Tags List 10",     "Custom Tags List 10", $iniFile);
			 			 		 			 
//CTL10 - taggedlist = $CTL10B								   								   								  								   								   							   							   
								   $CTL10B = replacelist("$CTL10", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL10B to ", "								   
                                   $CTL10B = replace("$CTL10B", ", ", ",");									   
								   $CTL10B = replace("$CTL10B", ",,", ",");	
								   $CTL10B = replace("$CTL10B", ",,", ",");
								   $CTL10B = replace("$CTL10B", ",", ", ");
								   
//combination $CTL10B								   
								   $CTL10B = ", " . "$CTL10B";
								   $CTL10B = replace("$CTL10B", ", , ", ", ");
//If $CTL10B = empty, $CTL10B = empty																
								   if $CTL10B == "+" {$CTL10B = ""};
		     $CustomTagsListC10=inputselect("Select<crlf>Custom Tags List 10", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>, <Search Here>$taggedlist3$CTL10B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find Items by Tags List", , ":qns");
			    if $CustomTagsListC10 == "cancel" {end 1==1};

//taglist - CTL10 = $AdTags10			
                                   $CTL10C = replace($CTL10,", ", "|");				   								   								  								   								   							   							   
								   $AddTags10 = replacelist("$taglist", "$CTL10C|, ", "", "|", 0, 1);	

//replace $AddTags10 to ", "								   
                                   $AddTags10 = replace("$AddTags10", ", ", ",");									   
								   $AddTags10 = replace("$AddTags10", ",,", ",");	
								   $AddTags10 = replace("$AddTags10", ",,", ",");
								   $AddTags10 = replace("$AddTags10", ",", ", ");								   

//Add Tags to Custom Tags List 10          
			    if(regexmatches($CustomTagsListC10, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text10=inputselect("Select<crlf>Add Tags to Custom Tags List 10", "$AddTags10", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 10", , ":qns");
	              if $text10 == "cancel" {end 1==1};	
				  $text10 = "$text10, ";
				  if $text10 == ", " {$text10 = ""};					  
                  setkey "$text10$CTL10", "Custom Tags List 10", "Custom Tags List 10", $iniFile; status "Added to <Custom Tags List 10>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 10										
                if(regexmatches($CustomTagsListC10, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL10 = formatlist(replace($CTL10, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD10 = input("Edit Custom Tags List 10", , $CTL10, "m", $CTL10, 500, 665);
   		          $CustomTagsListD10 = replace($CustomTagsListD10, <crlf>, ", ");
	              setkey $CustomTagsListD10, "Custom Tags List 10", "Custom Tags List 10", $iniFile; status "Done."; end 1==1;
			      }	
                if(regexmatches($CustomTagsListC10, "<Search Here>")) {$Where = "<curpath>"; $CustomTagsListC10 = replace("$CustomTagsListC10","<Search Here>","")};				  
				if(!regexmatches($CustomTagsListC10, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC10, "<Edit Current Tags List>"))) {$CustomTagsListC10 = replace($CustomTagsListC10,", ","|"); $CustomTagsListC10 = "$CustomTagsListC10"; goto "$Where?tags: $CustomTagsListC10 /r"; end 1==1;};		   
		  }	

Code: Select all

//@Function : Add Tags or Labels byList
//@Created : 2022-02-05
//@Modified: 2022-07-19
//@Version 2.63

    // Handle .ini file
    $iniFile = self("path") . "\" . self("base") . "CustomTagsList" . ".ini";

    // Write .ini file if missing
    if (exists($iniFile) != 1) {
        $iniContent = <<<'>>>'


//Tags List
[Custom Labels List]
Custom Labels List=Red, Orange, Yellow, Green, Blue, Purple, Grey

[Custom Tags List 1]
Custom Tags List 1=

[Custom Tags List 2]
Custom Tags List 2=

[Custom Tags List 3]
Custom Tags List 3=

[Custom Tags List 4]
Custom Tags List 4=

[Custom Tags List 5]
Custom Tags List 5=

[Custom Tags List 6]
Custom Tags List 6=

[Custom Tags List 7]
Custom Tags List 7=

[Custom Tags List 8]
Custom Tags List 8=

[Custom Tags List 9]
Custom Tags List 9=

[Custom Tags List 10]
Custom Tags List 10=

; The last query you've used
LastQuery=
        >>>;
        writefile($iniFile, $iniContent, , "tu");
    }
	
	
	
	
	
	
//Get tags
                                   $taglist = formatlist(taglist(), "t", ", ");        //Get taglist
								   $curitemTag = tagitems("tags", , "<curitem>", 1);   //The tag(s) of the current item
								   $selItemsTag = tagitems("tags", , , 1);             //Tag(s) of selected items
								   $selItemsTag = formatlist($selItemsTag, "sd");      //Remove duplicate tags of $selItemsTag
								   
//$taglist - $curitemTag = $newtaglist
                                   $newtaglist = "";
                                   foreach($taglist1, $taglist, ", ", "e") {
								      $case = "";
								      foreach($curitemTag1, $curitemTag, ", ", "e") {
									     if($taglist1 == $curitemTag1) {$case = "1";}
										 }
									  if($case == "") {$newtaglist .= "$taglist1" . ", ";}
									  }
									
								   $newtaglist2 = substr($newtaglist, 0, -2);
								   
//If $sleItemsTag contains empty tag(s) / Untagged item(s), set $case2 = 1, then break
                                   foreach($selItemsTag1, $selItemsTag, "|") {
								      if($selItemsTag1 == "") {$case2 = "1"; break;}
								      }
									  
								   switch($case2) {                                    //Switch $case2
								      case "1":
									    $taglist2 = $taglist;                          //Show only list of tags
										break;
									  default:
									    //Set $newCuritemTag separated by ", +"
								        $newCuritemTag = "";
								        foreach($curitemTag11, $curitemTag, ", ") {
								           $newCuritemTag .= "+" . "$curitemTag11" . ", ";
									       }
								      $taglist2 = "$newCuritemTag" . "$newtaglist2";   //Combination $newCuritemTag & $newtaglist2
								      }
									  
//Menu								   
                                   $C = "<Labels List>, <Life>, <Work>, <Custom Tags List 3>, <Custom Tags List 4>, <Custom Tags List 5>, <Custom Tags List 6>, <Custom Tags List 7>, <Custom Tags List 8>, <Custom Tags List 9>, <Custom Tags List 10>, ->Remove Tags->, <Copy Tags>, ->Remove Labels->, 丨Red丨, 丨Orange丨, 丨Yellow丨, 丨Green丨, 丨Blue丨, 丨Purple丨, 丨Grey丨";								   
 
//window 
                                   $data=inputselect("Select", "$C, $taglist2",", " ,3:=4+64+4096, "cancel", 500, 665, "Add Tags or Labels by List", , ":favfiles-");						 

//Get Custom Labels
								   $CLabelsL = getkey("Custom Labels List",     "Custom Labels List", $iniFile);


//Cancel
  	    if $data == "cancel" {end 1==1}; 		

//Remove Tags
        if(regexmatches($data, "->Remove Tags->")) {tag , , 1, 2; end 1==1;};
		
//Copy Tags
        $T = formatlist(replace($taglist, ", ", <crlf>), "e", <crlf>);
        if(regexmatches($data, "<Copy Tags>")) {$Tagslist = input("Tags List:", , $T, "m", $taglist, 500, 665); end 1==1; };		

//Remove Labels
        if(regexmatches($data, "->Remove Labels->")) {tag; end 1==1;};

//Labels

		if(regexmatches($data, "丨Red丨")) {$data = replace($data, "丨",""); tagitems(, "$data"); end 1==1};
		if(regexmatches($data, "丨Orange丨")) {$data = replace($data, "丨",""); tagitems(, "$data"); end 1==1;};
		if(regexmatches($data, "丨Yellow丨")) {$data = replace($data, "丨",""); tagitems(, "$data"); end 1==1;};
		if(regexmatches($data, "丨Green丨")) {$data = replace($data, "丨",""); tagitems(, "$data"); end 1==1;};
		if(regexmatches($data, "丨Blue丨")) {$data = replace($data, "丨",""); tagitems(, "$data"); end 1==1;};
		if(regexmatches($data, "丨Purple丨")) {$data = replace($data, "丨",""); tagitems(, "$data"); end 1==1;};
		if(regexmatches($data, "丨Grey丨")) {$data = replace($data, "丨",""); tagitems(, "$data"); end 1==1;};				 		  

        if(regexmatches($data, "<Labels List>"))
          {		  
	       $Labels=inputselect("Select", "<Edit Custom Labels List>, $CLabelsL", ", " ,3:=4+4096, "cancel", 500, 665, "Add Labels by List", , ":labels");
		   $Labels=replace($Labels,"<Labels List>",);
		 if ($Labels == "cancel") {end 1==1;};
         if ($Labels != <Edit Custom Labels List>) {tagitems(, "$Labels"); end 1==1};	
		 if $Labels == "<Edit Custom Labels List>"	 
           {
		   	$CLabelsL = getkey("Custom Labels List",     "Custom Labels List", $iniFile);  	
            $CLabelsL = formatlist(replace($CLabelsL, ", ", <crlf>), "e", <crlf>);
            $CustomLabelsList = input("<Edit Custom Labels List>", , $CLabelsL, "m", $CLabelsL, 500, 665);	
		    $CustomLabelsList = replace($CustomLabelsList, <crlf>, ", ");
	        setkey $CustomLabelsList, "Custom Labels List", "Custom Labels List", $iniFile;	status "Custom Labels List Saved"; end 1==1;
           }
          }


       		  
//Tags->
//tagitem(s)		
		if(!regexmatches($data, "<Life>") && !regexmatches($data, "<Work>") && !regexmatches($data, "<Custom Tags List 3>") && !regexmatches($data, "<Custom Tags List 4>") && !regexmatches($data, "<Custom Tags List 5>") && !regexmatches($data, "<Custom Tags List 6>") && !regexmatches($data, "<Custom Tags List 7>") && !regexmatches($data, "<Custom Tags List 8>") && !regexmatches($data, "<Custom Tags List 9>") && !regexmatches($data, "<Custom Tags List 10>")) {tag $data, , 1, 1; end 1==1;};




//$taglist3
								   $taglist3 = replace($taglist,", ", "|");								   
//CustomTagsList 1		
        if(regexmatches($data, "<Life>")) 		
		  {	
	         $CTL1 = getkey("Custom Tags List 1",     "Custom Tags List 1", $iniFile);
			 			 		 			 
//CTL1 - taggedlist = $CTL1B								   								   								  								   								   							   							   
								   $CTL1B = replacelist("$CTL1", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL1B to ", "								   
                                   $CTL1B = replace("$CTL1B", ", ", ",");									   
								   $CTL1B = replace("$CTL1B", ",,", ",");	
								   $CTL1B = replace("$CTL1B", ",,", ",");
								   $CTL1B = replace("$CTL1B", ",", ", ");
								   
//combination $CTL1B								   
								   $CTL1B = ", " . "$CTL1B";
								   $CTL1B = replace("$CTL1B", ", , ", ", ");
//If $CTL1B = empty, $CTL1B = empty																
								   if $CTL1B == "+" {$CTL1B = ""};
		     $CustomTagsListC1=inputselect("Select<crlf>Custom Tags List 1", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL1B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC1 == "cancel" {end 1==1};

//taglist - CTL1 = $AdTags			
                                   $CTL1C = replace($CTL1,", ", "|");				   								   								  								   								   							   							   
								   $AddTags = replacelist("$taglist", "$CTL1C|, ", "", "|", 0, 1);	

//replace $AddTags to ", "								   
                                   $AddTags = replace("$AddTags", ", ", ",");									   
								   $AddTags = replace("$AddTags", ",,", ",");	
								   $AddTags = replace("$AddTags", ",,", ",");
								   $AddTags = replace("$AddTags", ",", ", ");								   

//Add Tags to Custom Tags List 1          
			    if(regexmatches($CustomTagsListC1, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text1=inputselect("Select<crlf>Add Tags to Custom Tags List 1", "$AddTags", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 1", , ":cfi");
	              if $text1 == "cancel" {end 1==1};
				  $text1 = "$text1, ";
				  if $text1 == ", " {$text1 = ""};		  
                  setkey "$text1$CTL1", "Custom Tags List 1", "Custom Tags List 1", $iniFile; status "Added to <Life>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 1										
                if(regexmatches($CustomTagsListC1, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL1 = formatlist(replace($CTL1, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD1 = input("Edit Custom Tags List 1", , $CTL1, "m", $CTL1, 500, 665);
   		          $CustomTagsListD1 = replace($CustomTagsListD1, <crlf>, ", ");
	              setkey $CustomTagsListD1, "Custom Tags List 1", "Custom Tags List 1", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC1, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC1, "<Edit Current Tags List>"))) {tag "$CustomTagsListC1", , 1, 1; end 1==1;};		   
		  }	





//CustomTagsList 2		
        if(regexmatches($data, "<Work>")) 		
		  {	
	         $CTL2 = getkey("Custom Tags List 2",     "Custom Tags List 2", $iniFile);
			 			 		 			 
//CTL2 - taggedlist = $CTL2B								   								   								  								   								   							   							   
								   $CTL2B = replacelist("$CTL2", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL2B to ", "								   
                                   $CTL2B = replace("$CTL2B", ", ", ",");									   
								   $CTL2B = replace("$CTL2B", ",,", ",");	
								   $CTL2B = replace("$CTL2B", ",,", ",");
								   $CTL2B = replace("$CTL2B", ",", ", ");
								   
//combination $CTL2B								   
								   $CTL2B = ", " . "$CTL2B";

//If $CTL2B = empty, $CTL2B = empty																
								   if $CTL2B == "+" {$CTL2B = ""};
		     $CustomTagsListC2=inputselect("Select<crlf>Custom Tags List 2", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL2B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC2 == "cancel" {end 1==1};

//taglist - CTL2 = $AdTags2			
                                   $CTL2C = replace($CTL2,", ", "|");				   								   								  								   								   							   							   
								   $AddTags2 = replacelist("$taglist", "$CTL2C|, ", "", "|", 0, 1);	

//replace $AddTags2 to ", "								   
                                   $AddTags2 = replace("$AddTags2", ", ", ",");									   
								   $AddTags2 = replace("$AddTags2", ",,", ",");	
								   $AddTags2 = replace("$AddTags2", ",,", ",");
								   $AddTags2 = replace("$AddTags2", ",", ", ");								   

//Add Tags to Custom Tags List 2         
			    if(regexmatches($CustomTagsListC2, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text2=inputselect("Select<crlf>Add Tags to Custom Tags List 2", "$AddTags2", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 1", , ":cfi");
	              if $text2 == "cancel" {end 1==1};
				  $text2 = "$text2, ";
				  if $text2 == ", " {$text2 = ""};					  
                  setkey "$text2$CTL2", "Custom Tags List 2", "Custom Tags List 2", $iniFile; status "Added to <Work>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 2										
                if(regexmatches($CustomTagsListC2, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL2 = formatlist(replace($CTL2, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD2 = input("Edit Custom Tags List 2", , $CTL2, "m", $CTL2, 500, 665);
   		          $CustomTagsListD2 = replace($CustomTagsListD2, <crlf>, ", ");
	              setkey $CustomTagsListD2, "Custom Tags List 2", "Custom Tags List 2", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC2, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC2, "<Edit Current Tags List>"))) {tag "$CustomTagsListC2", , 1, 1; end 1==1;};		   
		  }	





//CustomTagsList 3		
        if(regexmatches($data, "<Custom Tags List 3>")) 		
		  {	
	         $CTL3 = getkey("Custom Tags List 3",     "Custom Tags List 3", $iniFile);
			 			 		 			 
//CTL3 - taggedlist = $CTL3B								   								   								  								   								   							   							   
								   $CTL3B = replacelist("$CTL3", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL3B to ", "								   
                                   $CTL3B = replace("$CTL3B", ", ", ",");									   
								   $CTL3B = replace("$CTL3B", ",,", ",");	
								   $CTL3B = replace("$CTL3B", ",,", ",");
								   $CTL3B = replace("$CTL3B", ",", ", ");
								   
//combination $CTL3B								   
								   $CTL3B = ", " . "$CTL3B";
								   $CTL3B = replace("$CTL3B", ", , ", ", ");
//If $CTL3B = empty, $CTL3B = empty																
								   if $CTL3B == "+" {$CTL3B = ""};
		     $CustomTagsListC3=inputselect("Select<crlf>Custom Tags List 3", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL3B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC3 == "cancel" {end 1==1};

//taglist - CTL3 = $AddTags3			
                                   $CTL3C = replace($CTL3,", ", "|");				   								   								  								   								   							   							   
								   $AddTags3 = replacelist("$taglist", "$CTL3C|, ", "", "|", 0, 1);	

//replace $AddTags3 to ", "								   
                                   $AddTags3 = replace("$AddTags3", ", ", ",");									   
								   $AddTags3 = replace("$AddTags3", ",,", ",");	
								   $AddTags3 = replace("$AddTags3", ",,", ",");
								   $AddTags3 = replace("$AddTags3", ",", ", ");								   

//Add Tags to Custom Tags List 3          
			    if(regexmatches($CustomTagsListC3, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text3=inputselect("Select<crlf>Add Tags to Custom Tags List 3", "$AddTags3", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 3", , ":cfi");
	              if $text3 == "cancel" {end 1==1};	
				  $text3 = "$text3, ";
				  if $text3 == ", " {$text3 = ""};	                  				  
                  setkey "$text3$CTL3", "Custom Tags List 3", "Custom Tags List 3", $iniFile; status "Added to <Custom Tags List 3>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 3										
                if(regexmatches($CustomTagsListC3, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL3 = formatlist(replace($CTL3, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD3 = input("Edit Custom Tags List 3", , $CTL3, "m", $CTL3, 500, 665);
   		          $CustomTagsListD3 = replace($CustomTagsListD3, <crlf>, ", ");
	              setkey $CustomTagsListD3, "Custom Tags List 3", "Custom Tags List 3", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC3, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC3, "<Edit Current Tags List>"))) {tag "$CustomTagsListC3", , 1, 1; end 1==1;};		   
		  }	
		  
		  
		  
		  
		  
//CustomTagsList 4		
        if(regexmatches($data, "<Custom Tags List 4>")) 		
		  {	
	         $CTL4 = getkey("Custom Tags List 4",     "Custom Tags List 4", $iniFile);
			 			 		 			 
//CTL4 - taggedlist = $CTL4B								   								   								  								   								   							   							   
								   $CTL4B = replacelist("$CTL4", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL4B to ", "								   
                                   $CTL4B = replace("$CTL4B", ", ", ",");									   
								   $CTL4B = replace("$CTL4B", ",,", ",");	
								   $CTL4B = replace("$CTL4B", ",,", ",");
								   $CTL4B = replace("$CTL4B", ",", ", ");
								   
//combination $CTL4B								   
								   $CTL4B = ", " . "$CTL4B";

//If $CTL4B = empty, $CTL4B = empty																
								   if $CTL4B == "+" {$CTL4B = ""};
		     $CustomTagsListC4=inputselect("Select<crlf>Custom Tags List 4", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL4B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC4 == "cancel" {end 1==1};

//taglist - CTL4 = $AdTags4			
                                   $CTL4C = replace($CTL4,", ", "|");				   								   								  								   								   							   							   
								   $AddTags4 = replacelist("$taglist", "$CTL4C|, ", "", "|", 0, 1);	

//replace $AddTags4 to ", "								   
                                   $AddTags4 = replace("$AddTags4", ", ", ",");									   
								   $AddTags4 = replace("$AddTags4", ",,", ",");	
								   $AddTags4 = replace("$AddTags4", ",,", ",");
								   $AddTags4 = replace("$AddTags4", ",", ", ");								   

//Add Tags to Custom Tags List 4          
			    if(regexmatches($CustomTagsListC4, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text4=inputselect("Select<crlf>Add Tags to Custom Tags List 4", "$AddTags4", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 4", , ":cfi");
	              if $text4 == "cancel" {end 1==1};	
				  $text4 = "$text4, ";
				  if $text4 == ", " {$text4 = ""};					  
                  setkey "$text4$CTL4", "Custom Tags List 4", "Custom Tags List 4", $iniFile; status "Added to <Custom Tags List 4>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 4										
                if(regexmatches($CustomTagsListC4, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL4 = formatlist(replace($CTL4, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD4 = input("Edit Custom Tags List 4", , $CTL4, "m", $CTL4, 500, 665);
   		          $CustomTagsListD4 = replace($CustomTagsListD4, <crlf>, ", ");
	              setkey $CustomTagsListD4, "Custom Tags List 4", "Custom Tags List 4", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC4, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC4, "<Edit Current Tags List>"))) {tag "$CustomTagsListC4", , 1, 1; end 1==1;};		   
		  }	




//CustomTagsList 5		
        if(regexmatches($data, "<Custom Tags List 5>")) 		
		  {	
	         $CTL5 = getkey("Custom Tags List 5",     "Custom Tags List 5", $iniFile);
			 			 		 			 
//CTL5 - taggedlist = $CTL5B								   								   								  								   								   							   							   
								   $CTL5B = replacelist("$CTL5", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL5B to ", "								   
                                   $CTL5B = replace("$CTL5B", ", ", ",");									   
								   $CTL5B = replace("$CTL5B", ",,", ",");	
								   $CTL5B = replace("$CTL5B", ",,", ",");
								   $CTL5B = replace("$CTL5B", ",", ", ");
								   
//combination $CTL5B								   
								   $CTL5B = ", " . "$CTL5B";
								   $CTL5B = replace("$CTL5B", ", , ", ", ");
//If $CTL5B = empty, $CTL5B = empty																
								   if $CTL5B == "+" {$CTL5B = ""};
		     $CustomTagsListC5=inputselect("Select<crlf>Custom Tags List 5", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL5B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC5 == "cancel" {end 1==1};

//taglist - CTL5 = $AdTags5			
                                   $CTL5C = replace($CTL5,", ", "|");				   								   								  								   								   							   							   
								   $AddTags5 = replacelist("$taglist", "$CTL5C|, ", "", "|", 0, 1);	

//replace $AddTags5 to ", "								   
                                   $AddTags5 = replace("$AddTags5", ", ", ",");									   
								   $AddTags5 = replace("$AddTags5", ",,", ",");	
								   $AddTags5 = replace("$AddTags5", ",,", ",");
								   $AddTags5 = replace("$AddTags5", ",", ", ");								   

//Add Tags to Custom Tags List 5          
			    if(regexmatches($CustomTagsListC5, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text5=inputselect("Select<crlf>Add Tags to Custom Tags List 5", "$AddTags5", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 5", , ":cfi");
	              if $text5 == "cancel" {end 1==1};		
				  $text5 = "$text5, ";
				  if $text5 == ", " {$text5 = ""};					  
                  setkey "$text5$CTL5", "Custom Tags List 5", "Custom Tags List 5", $iniFile; status "Added to <Custom Tags List 5>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 5										
                if(regexmatches($CustomTagsListC5, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL5 = formatlist(replace($CTL5, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD5 = input("Edit Custom Tags List 5", , $CTL5, "m", $CTL5, 500, 665);
   		          $CustomTagsListD5 = replace($CustomTagsListD5, <crlf>, ", ");
	              setkey $CustomTagsListD5, "Custom Tags List 5", "Custom Tags List 5", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC5, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC5, "<Edit Current Tags List>"))) {tag "$CustomTagsListC5", , 1, 1; end 1==1;};		   
		  }	




//CustomTagsList 6		
        if(regexmatches($data, "<Custom Tags List 6>")) 		
		  {	
	         $CTL6 = getkey("Custom Tags List 6",     "Custom Tags List 6", $iniFile);
			 			 		 			 
//CTL6 - taggedlist = $CTL6B								   								   								  								   								   							   							   
								   $CTL6B = replacelist("$CTL6", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL6B to ", "								   
                                   $CTL6B = replace("$CTL6B", ", ", ",");									   
								   $CTL6B = replace("$CTL6B", ",,", ",");	
								   $CTL6B = replace("$CTL6B", ",,", ",");
								   $CTL6B = replace("$CTL6B", ",", ", ");
								   
//combination $CTL6B								   
								   $CTL6B = ", " . "$CTL6B";
								   $CTL6B = replace("$CTL6B", ", , ", ", ");
//If $CTL6B = empty, $CTL6B = empty																
								   if $CTL6B == "+" {$CTL6B = ""};
		     $CustomTagsListC6=inputselect("Select<crlf>Custom Tags List 6", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL6B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC6 == "cancel" {end 1==1};

//taglist - CTL6 = $AdTags6			
                                   $CTL6C = replace($CTL6,", ", "|");				   								   								  								   								   							   							   
								   $AddTags6 = replacelist("$taglist", "$CTL6C|, ", "", "|", 0, 1);	

//replace $AddTags6 to ", "								   
                                   $AddTags6 = replace("$AddTags6", ", ", ",");									   
								   $AddTags6 = replace("$AddTags6", ",,", ",");	
								   $AddTags6 = replace("$AddTags6", ",,", ",");
								   $AddTags6 = replace("$AddTags6", ",", ", ");								   

//Add Tags to Custom Tags List 6          
			    if(regexmatches($CustomTagsListC6, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text6=inputselect("Select<crlf>Add Tags to Custom Tags List 6", "$AddTags6", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 6", , ":cfi");
	              if $text6 == "cancel" {end 1==1};
				  $text6 = "$text6, ";
				  if $text6 == ", " {$text6 = ""};					  
                  setkey "$text6$CTL6", "Custom Tags List 6", "Custom Tags List 6", $iniFile; status "Added to <Custom Tags List 6>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 6										
                if(regexmatches($CustomTagsListC6, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL6 = formatlist(replace($CTL6, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD6 = input("Edit Custom Tags List 6", , $CTL6, "m", $CTL6, 500, 665);
   		          $CustomTagsListD6 = replace($CustomTagsListD6, <crlf>, ", ");
	              setkey $CustomTagsListD6, "Custom Tags List 6", "Custom Tags List 6", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC6, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC6, "<Edit Current Tags List>"))) {tag "$CustomTagsListC6", , 1, 1; end 1==1;};		   
		  }	




//CustomTagsList 7		
        if(regexmatches($data, "<Custom Tags List 7>")) 		
		  {	
	         $CTL7 = getkey("Custom Tags List 7",     "Custom Tags List 7", $iniFile);
			 			 		 			 
//CTL7 - taggedlist = $CTL7B								   								   								  								   								   							   							   
								   $CTL7B = replacelist("$CTL7", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL7B to ", "								   
                                   $CTL7B = replace("$CTL7B", ", ", ",");									   
								   $CTL7B = replace("$CTL7B", ",,", ",");	
								   $CTL7B = replace("$CTL7B", ",,", ",");
								   $CTL7B = replace("$CTL7B", ",", ", ");
								   
//combination $CTL7B								   
								   $CTL7B = ", " . "$CTL7B";

//If $CTL7B = empty, $CTL7B = empty																
								   if $CTL7B == "+" {$CTL7B = ""};
		     $CustomTagsListC7=inputselect("Select<crlf>Custom Tags List 7", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL7B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC7 == "cancel" {end 1==1};

//taglist - CTL7 = $AdTags7			
                                   $CTL7C = replace($CTL7,", ", "|");				   								   								  								   								   							   							   
								   $AddTags7 = replacelist("$taglist", "$CTL7C|, ", "", "|", 0, 1);	

//replace $AddTags7 to ", "								   
                                   $AddTags7 = replace("$AddTags7", ", ", ",");									   
								   $AddTags7 = replace("$AddTags7", ",,", ",");	
								   $AddTags7 = replace("$AddTags7", ",,", ",");
								   $AddTags7 = replace("$AddTags7", ",", ", ");								   

//Add Tags to Custom Tags List 7          
			    if(regexmatches($CustomTagsListC7, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text7=inputselect("Select<crlf>Add Tags to Custom Tags List 7", "$AddTags7", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 7", , ":cfi");
	              if $text7 == "cancel" {end 1==1};	
				  $text7 = "$text7, ";
				  if $text7 == ", " {$text7 = ""};					  
                  setkey "$text7$CTL7", "Custom Tags List 7", "Custom Tags List 7", $iniFile; status "Added to <Custom Tags List 7>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 7										
                if(regexmatches($CustomTagsListC7, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL7 = formatlist(replace($CTL7, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD7 = input("Edit Custom Tags List 7", , $CTL7, "m", $CTL7, 500, 665);
   		          $CustomTagsListD7 = replace($CustomTagsListD7, <crlf>, ", ");
	              setkey $CustomTagsListD7, "Custom Tags List 7", "Custom Tags List 7", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC7, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC7, "<Edit Current Tags List>"))) {tag "$CustomTagsListC7", , 1, 1; end 1==1;};		   
		  }	




//CustomTagsList 8		
        if(regexmatches($data, "<Custom Tags List 8>")) 		
		  {	
	         $CTL8 = getkey("Custom Tags List 8",     "Custom Tags List 8", $iniFile);
			 			 		 			 
//CTL8 - taggedlist = $CTL8B								   								   								  								   								   							   							   
								   $CTL8B = replacelist("$CTL8", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL8B to ", "								   
                                   $CTL8B = replace("$CTL8B", ", ", ",");									   
								   $CTL8B = replace("$CTL8B", ",,", ",");	
								   $CTL8B = replace("$CTL8B", ",,", ",");
								   $CTL8B = replace("$CTL8B", ",", ", ");
								   
//combination $CTL8B								   
								   $CTL8B = ", " . "$CTL8B";
								   $CTL8B = replace("$CTL8B", ", , ", ", ");
//If $CTL8B = empty, $CTL8B = empty																
								   if $CTL8B == "+" {$CTL8B = ""};
		     $CustomTagsListC8=inputselect("Select<crlf>Custom Tags List 8", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL8B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC8 == "cancel" {end 1==1};

//taglist - CTL8 = $AdTags8			
                                   $CTL8C = replace($CTL8,", ", "|");				   								   								  								   								   							   							   
								   $AddTags8 = replacelist("$taglist", "$CTL8C|, ", "", "|", 0, 1);	

//replace $AddTags8 to ", "								   
                                   $AddTags8 = replace("$AddTags8", ", ", ",");									   
								   $AddTags8 = replace("$AddTags8", ",,", ",");	
								   $AddTags8 = replace("$AddTags8", ",,", ",");
								   $AddTags8 = replace("$AddTags8", ",", ", ");								   

//Add Tags to Custom Tags List 8          
			    if(regexmatches($CustomTagsListC8, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text8=inputselect("Select<crlf>Add Tags to Custom Tags List 8", "$AddTags8", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 8", , ":cfi");
	              if $text8 == "cancel" {end 1==1};	
				  $text8 = "$text8, ";
				  if $text8 == ", " {$text8 = ""};					  
                  setkey "$text8$CTL8", "Custom Tags List 8", "Custom Tags List 8", $iniFile; status "Added to <Custom Tags List 8>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 8										
                if(regexmatches($CustomTagsListC8, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL8 = formatlist(replace($CTL8, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD8 = input("Edit Custom Tags List 8", , $CTL8, "m", $CTL8, 500, 665);
   		          $CustomTagsListD8 = replace($CustomTagsListD8, <crlf>, ", ");
	              setkey $CustomTagsListD8, "Custom Tags List 8", "Custom Tags List 8", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC8, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC8, "<Edit Current Tags List>"))) {tag "$CustomTagsListC8", , 1, 1; end 1==1;};		   
		  }	




//CustomTagsList 9		
        if(regexmatches($data, "<Custom Tags List 9>")) 		
		  {	
	         $CTL9 = getkey("Custom Tags List 9",     "Custom Tags List 9", $iniFile);
			 			 		 			 
//CTL9 - taggedlist = $CTL9B								   								   								  								   								   							   							   
								   $CTL9B = replacelist("$CTL9", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL9B to ", "								   
                                   $CTL9B = replace("$CTL9B", ", ", ",");									   
								   $CTL9B = replace("$CTL9B", ",,", ",");	
								   $CTL9B = replace("$CTL9B", ",,", ",");
								   $CTL9B = replace("$CTL9B", ",", ", ");
								   
//combination $CTL9B								   
								   $CTL9B = ", " . "$CTL9B";

//If $CTL9B = empty, $CTL9B = empty																
								   if $CTL9B == "+" {$CTL9B = ""};
		     $CustomTagsListC9=inputselect("Select<crlf>Custom Tags List 9", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL9B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC9 == "cancel" {end 1==1};

//taglist - CTL9 = $AdTags9			
                                   $CTL9C = replace($CTL9,", ", "|");				   								   								  								   								   							   							   
								   $AddTags9 = replacelist("$taglist", "$CTL9C|, ", "", "|", 0, 1);	

//replace $AddTags9 to ", "								   
                                   $AddTags9 = replace("$AddTags9", ", ", ",");									   
								   $AddTags9 = replace("$AddTags9", ",,", ",");	
								   $AddTags9 = replace("$AddTags9", ",,", ",");
								   $AddTags9 = replace("$AddTags9", ",", ", ");								   

//Add Tags to Custom Tags List 9          
			    if(regexmatches($CustomTagsListC9, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text9=inputselect("Select<crlf>Add Tags to Custom Tags List 9", "$AddTags9", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 9", , ":cfi");
	              if $text9 == "cancel" {end 1==1};
				  $text9 = "$text9, ";
				  if $text9 == ", " {$text9 = ""};					  
                  setkey "$text9$CTL9", "Custom Tags List 9", "Custom Tags List 9", $iniFile; status "Added to <Custom Tags List 9>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 9										
                if(regexmatches($CustomTagsListC9, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL9 = formatlist(replace($CTL9, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD9 = input("Edit Custom Tags List 9", , $CTL9, "m", $CTL9, 500, 665);
   		          $CustomTagsListD9 = replace($CustomTagsListD9, <crlf>, ", ");
	              setkey $CustomTagsListD9, "Custom Tags List 9", "Custom Tags List 9", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC9, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC9, "<Edit Current Tags List>"))) {tag "$CustomTagsListC9", , 1, 1; end 1==1;};		   
		  }	




//CustomTagsList 10		
        if(regexmatches($data, "<Custom Tags List 10>")) 		
		  {	
	         $CTL10 = getkey("Custom Tags List 10",     "Custom Tags List 10", $iniFile);
			 			 		 			 
//CTL10 - taggedlist = $CTL10B								   								   								  								   								   							   							   
								   $CTL10B = replacelist("$CTL10", "$taggedlist2|, ", "", "|", 0, 1);
								   
//replace $CTL10B to ", "								   
                                   $CTL10B = replace("$CTL10B", ", ", ",");									   
								   $CTL10B = replace("$CTL10B", ",,", ",");	
								   $CTL10B = replace("$CTL10B", ",,", ",");
								   $CTL10B = replace("$CTL10B", ",", ", ");
								   
//combination $CTL10B								   
								   $CTL10B = ", " . "$CTL10B";
								   $CTL10B = replace("$CTL10B", ", , ", ", ");
//If $CTL10B = empty, $CTL10B = empty																
								   if $CTL10B == "+" {$CTL10B = ""};
		     $CustomTagsListC10=inputselect("Select<crlf>Custom Tags List 10", "<Add Tags to Current List From Taglist>, <Edit Current Tags List>$taggedlist3$CTL10B", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags by List", , ":cfi");
			    if $CustomTagsListC10 == "cancel" {end 1==1};

//taglist - CTL10 = $AdTags10			
                                   $CTL10C = replace($CTL10,", ", "|");				   								   								  								   								   							   							   
								   $AddTags10 = replacelist("$taglist", "$CTL10C|, ", "", "|", 0, 1);	

//replace $AddTags10 to ", "								   
                                   $AddTags10 = replace("$AddTags10", ", ", ",");									   
								   $AddTags10 = replace("$AddTags10", ",,", ",");	
								   $AddTags10 = replace("$AddTags10", ",,", ",");
								   $AddTags10 = replace("$AddTags10", ",", ", ");								   

//Add Tags to Custom Tags List 10          
			    if(regexmatches($CustomTagsListC10, "<Add Tags to Current List From Taglist>"))
				  {				  
	              $text10=inputselect("Select<crlf>Add Tags to Custom Tags List 10", "$AddTags10", ", " ,3:=2+64+4096, "cancel", 500, 665, "Add Tags to Custom Tags List 10", , ":cfi");
	              if $text10 == "cancel" {end 1==1};	
				  $text10 = "$text10, ";
				  if $text10 == ", " {$text10 = ""};					  
                  setkey "$text10$CTL10", "Custom Tags List 10", "Custom Tags List 10", $iniFile; status "Added to <Custom Tags List 10>!";
				  end 1==1;
                  }
					
					
//Edit Custom Tags List 10										
                if(regexmatches($CustomTagsListC10, "<Edit Current Tags List>"))		   	  
		          {
			      $CTL10 = formatlist(replace($CTL10, ", ", <crlf>), "e", <crlf>);
                  $CustomTagsListD10 = input("Edit Custom Tags List 10", , $CTL10, "m", $CTL10, 500, 665);
   		          $CustomTagsListD10 = replace($CustomTagsListD10, <crlf>, ", ");
	              setkey $CustomTagsListD10, "Custom Tags List 10", "Custom Tags List 10", $iniFile; status "Done."; end 1==1;
			      }			 				  
				if(!regexmatches($CustomTagsListC10, "<Add Tags to Current List From Taglist>" && !regexmatches($CustomTagsListC10, "<Edit Current Tags List>"))) {tag "$CustomTagsListC10", , 1, 1; end 1==1;};		   
		  }	
Attachments
Find Items by Tags or Labels List.png
Find Items by Tags or Labels List.png (28.93 KiB) Viewed 1439 times
Find Items by Tags List.png
Find Items by Tags List.png (15.84 KiB) Viewed 1439 times
Add Tags or Labels byList.png
Add Tags or Labels byList.png (28.08 KiB) Viewed 1457 times
Last edited by Norn on 19 Jul 2022 18:36, edited 1 time in total.
Win10, Win11 @100% 2560x1440 22H2

Norn
Posts: 417
Joined: 24 Oct 2021 16:10

Re: Find all tags

Post by Norn »

Find by Tags & Labels List.

Code: Select all

//@Function : Find by Tags & Labels List
//Created  : 2022-04-11
//@Modified: 2022-08-22
//@Version : 5.5

//Get tags
                                   $taglist = formatlist(taglist(), "t", ", ");        //Get taglist
								   $curitemTag = tagitems("tags", , "<curitem>", 1);   //The tag(s) of the current item
								   $selItemsTag = tagitems("tags", , , 1);             //Tag(s) of selected items
								   $selItemsTag = formatlist($selItemsTag, "sd");      //Remove duplicate tags of $selItemsTag
								   
//$taglist - $curitemTag = $newtaglist
                                   $newtaglist = "";
                                   foreach($taglist1, $taglist, ", ", "e") {
								      $case = "";
								      foreach($curitemTag1, $curitemTag, ", ", "e") {
									     if($taglist1 == $curitemTag1) {$case = "1";}
										 }
									  if($case == "") {$newtaglist .= "$taglist1" . ", ";}
									  }
									
								   $newtaglist2 = substr($newtaglist, 0, -2);
								   
//If $sleItemsTag contains empty tag(s) / Untagged item(s), set $case2 = 1, then break
                                   foreach($selItemsTag1, $selItemsTag, "|") {
								      if($selItemsTag1 == "") {$case2 = "1"; break;}
								      }
									  
								   switch($case2) {                                    //Switch $case2
								      case "1":
									    $taglist2 = $taglist;                          //Show only list of tags
										break;
									  default:
									    //Set $newCuritemTag separated by ", +"
								        $newCuritemTag = "";
								        foreach($curitemTag11, $curitemTag, ", ") {
								           $newCuritemTag .= "+" . "$curitemTag11" . ", ";
									       }
								      $taglist2 = "$newCuritemTag" . "$newtaglist2";   //Combination $newCuritemTag & $newtaglist2
								      }
                                   
								   $lbl="<Search Here>, Red, Orange, Yellow, Green, Blue, Purple, Grey";
//combination
								   $tg = "$lbl" . ", $taglist2";
								   
								   //Open the Find window
                                   $text = inputselect("Find by Tags & Labels List", "$tg", ", " ,3:=2+64+4096, "cancel", 500, 665, "XYplorer", , ":qns");
								   if($text == "") {end '1==1';}
								   
								   $lbl2 = "";
								   $tags = "";
								   $find = "%computer%?";
								   
								   foreach($text1, $text, ", ",  "e") {
								      foreach($lbl1, $lbl, ", ") {
									     if($text1 == $lbl1) {$case = 1;}                                                 //If it is a label, $case is equal to 1
										 }
								      if($case == 1 && $text1 != "<Search Here>") {$lbl2 .= "$text1"  . " | ";            //If $case is equal to 1, stack
									    } else {
												if($text1 != "<Search Here>") {$tags .= "$text1" . " | ";}                //If not label or <Search Here>, stack
										} else {
										        if($text1 == "<Search Here>") {$find = "<curpath>?";}                     //If it is <Search Here>, $find equal to "<curpath>?"
										       }										            
						              $case = "";                                                                          //Set $case to empty
					                  }
								   
                                   if($lbl2 != "" && $tags != "") {$data = "$find" . "lbl:" . "$lbl2" . "tags:" . "$tags"; //If $lbl and $tags not empty, stack to find
								     } else {
									         if($lbl2 == "") {$data = "$find" . "tags:" . "$tags";}                        //else, if $lbl2 is empty, stack to find by tags
									 } else {
									         if($tags == "") {$data = "$find" . "lbl:" . "$lbl2";}                         //else, If $tags is empty, stack to find by label
											}
								   $data2 = substr($data, 0, -3);                                                          //Trim" | "
                                   
								   end ("$data"=="%computer%?tags:<Search Here>"), "Nothing selected, Abort!";

    if $text != "cancel"
    {
	tab("new", "$data2");
    }

Code: Select all

//@Function : Find by Tags & Labels List
//Created  : 2022-04-11
//@Modified: 2022-07-19
//@Version : 5.3

//Get tags
                                   $taglist = formatlist(taglist(), "t", ", ");        //Get taglist
								   $curitemTag = tagitems("tags", , "<curitem>", 1);   //The tag(s) of the current item
								   $selItemsTag = tagitems("tags", , , 1);             //Tag(s) of selected items
								   $selItemsTag = formatlist($selItemsTag, "sd");      //Remove duplicate tags of $selItemsTag
								   
//$taglist - $curitemTag = $newtaglist
                                   $newtaglist = "";
                                   foreach($taglist1, $taglist, ", ", "e") {
								      $case = "";
								      foreach($curitemTag1, $curitemTag, ", ", "e") {
									     if($taglist1 == $curitemTag1) {$case = "1";}
										 }
									  if($case == "") {$newtaglist .= "$taglist1" . ", ";}
									  }
									
								   $newtaglist2 = substr($newtaglist, 0, -2);
								   
//If $sleItemsTag contains empty tag(s) / Untagged item(s), set $case2 = 1, then break
                                   foreach($selItemsTag1, $selItemsTag, "|") {
								      if($selItemsTag1 == "") {$case2 = "1"; break;}
								      }
									  
								   switch($case2) {                                    //Switch $case2
								      case "1":
									    $taglist2 = $taglist;                          //Show only list of tags
										break;
									  default:
									    //Set $newCuritemTag separated by ", +"
								        $newCuritemTag = "";
								        foreach($curitemTag11, $curitemTag, ", ") {
								           $newCuritemTag .= "+" . "$curitemTag11" . ", ";
									       }
								      $taglist2 = "$newCuritemTag" . "$newtaglist2";   //Combination $newCuritemTag & $newtaglist2
								      }
                                   
								   $lbl="<Search Here>, Red, Orange, Yellow, Green, Blue, Purple, Grey";
//combination
								   $tg = "$lbl" . ", $taglist2";
								   
								   //Open the Find window
                                   $text = inputselect("Find by Tags & Labels List", "$tg", ", " ,3:=2+64+4096, "cancel", 500, 665, "Find by Tags & Labels List", , ":qns");
								   if($text == "") {end '1==1';}
                                   $data = "%computer%?tags:$text";
                                   $data = regexreplace($data, ", ", " | ");
								   
								   $data = replace("$data", "Red", "lbl:Red | tags:"); 
								   $data = replace("$data", "Orange", "lbl:Orange | tags:");
								   $data = replace("$data", "Yellow", "lbl:Yellow | tags:");
								   $data = replace("$data", "Green", "lbl:Green | tags:");
								   $data = replace("$data", "Blue", "lbl:Blue | tags:");
								   $data = replace("$data", "Purple", "lbl:Purple | tags:");
								   $data = replace("$data", "Grey", "lbl:Grey | tags:");
								   
								   $data = replace("$data", "%computer%?tags:<Search Here> | ", "<curpath>?tags:");
								   $data = replace("$data", " | tags: | ", " | tags:");
								   $data = replace("$data", "tags:lbl:", "lbl:");
								   $data = replace("$data", " | lbl:", " | ");
								   $data = replace("$data", " | tags: | lbl:", " | ");
								   $data = replace("$data", " | tags: | ", " | tags:");
								   $G = "$data /r";
								   $G = replacelist("$G"," | tags: /r卍 /r","","卍");      //Repalce " | tags: /r" and " /r" (Cannot use <.> and (.) etc as separator)
								   
                                   end ("$data"=="%computer%?tags:<Search Here>"), "No Label(s)/Tag(s) ticked, aborted!";
                                   
    if $text != "cancel"
    {
	tab("new", "$G");
    }
Attachments
Find by Tags & Labels List.png
Find by Tags & Labels List.png (26.18 KiB) Viewed 1424 times
Win10, Win11 @100% 2560x1440 22H2

Post Reply