Page 1 of 1

Add multiple tags using input command

Posted: 15 Sep 2012 09:38
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.

Re: Add multiple tags using input command

Posted: 15 Sep 2012 09:54
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

Re: Add multiple tags using input command

Posted: 15 Sep 2012 10:18
by kiwichick
Ah, so NO multi-line input - ONLY comma-separated. Doh, I didn't even try that! Thanks very much :biggrin: