Add multiple tags using input command

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kiwichick
Posts: 676
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Add multiple tags using input command

Post by kiwichick »

Hi there, I am trying to create a script to add tags using the input() command. I know I can just open the Add Tags window but I want to be able to edit the size and topic/notes of my 'input' window. And Add Tags only adds tags to the selected Files and Folders - I want to tag selected Files, Folders and selected Folders content (files, subfolders). This is what I have so far:

Code: Select all

end(getinfo("CountSelected") < 1), "At least one File or Folder must be selected!";

   $lstF = get(selecteditemspathnames);
   $a = input("Enter Tag to Add", , ,m);

   foreach ($tkF, $lstF, "<crlf>") {

   $tst = exists($tkF);
   IF ($tst == "0") { end 1, "Script will close - No items were selected!"; }
   ELSEIF ($tst == "1") { tag "$a", "$tkF", 1; continue 2; }
   ELSEIF ($tst == "2") {   }

   $lst = folderreport("items", "r", $tkF, "r");
   foreach ($tk, $lst, "<crlf>") {
   tag "$a", "$tk", 1;
                                 }

   tag "$a", "$tkF", 1;
                                   }
   status "Tagging done!", "339933";
It works on ALL selected files/folders/content but it only adds one tag. Multiple lines in the input window are added as a single-word tag. So if I enter:

cat
dog
mouse

The added tag is catdogmouse.

What am I missing? Cheers.
Windows 10 Pro 22H2

admin
Site Admin
Posts: 66366
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Add multiple tags using input command

Post by admin »

Comma!

Code: Select all

tag "cats,dogs", , 1; //add tags "cats" and "dogs" to all selected items
tag "cats,dogs", , 1, 1; //set tags "cats" and "dogs" to all selected items

kiwichick
Posts: 676
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: Add multiple tags using input command

Post by kiwichick »

Ah, so NO multi-line input - ONLY comma-separated. Doh, I didn't even try that! Thanks very much :biggrin:
Windows 10 Pro 22H2

Post Reply