Add multiple tags using input command
Posted: 15 Sep 2012 09:38
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:
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.
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";cat
dog
mouse
The added tag is catdogmouse.
What am I missing? Cheers.