Page 1 of 1
Tag and comment copying
Posted: 31 Oct 2019 13:22
by FKF5482
Hello, i would like to know, how can i copy all tags and comments from a file to another?
Thanks in advance.
Re: Tag and comment copying
Posted: 31 Oct 2019 18:22
by highend
By scripting it...
Only existing comments / tags are copied, if they are empty, the destination file will not store these empty tags / comment!
Code: Select all
$selected = <get SelectedItemsPathNames <crlf>>;
end (gettoken($selected, "count", <crlf>) != 2), "There are NOT two files selected!";
$text = "Is the first or the second selected item the source to copy from?";
$notes = "Enter either 1 or 2...";
$input = input($text, $notes, "1");
end (!regexmatches($input, "^(1|2)$")), "No source file defined, aborted!";
if ($input == 1) { $src = gettoken($selected, 1, <crlf>); $dst = gettoken($selected, 2, <crlf>); }
elseif ($input == 2) { $src = gettoken($selected, 2, <crlf>); $dst = gettoken($selected, 1, <crlf>); }
$comment = tagitems("cmt", , $src);
$tags = tagitems("tag", , $src);
if ($comment) { tagitems("cmt", $comment, $dst); }
if ($tags) { tagitems("tag", $tags , $dst); }
Re: Tag and comment copying
Posted: 31 Oct 2019 19:10
by FKF5482
Thank you very much Highend, its working perfectly!

Re: Tag and comment copying
Posted: 01 Nov 2019 11:08
by highend
This is probably a better one because it allows to copy tag(s) / comment to
all selected files even in different multiple directories...
You can change its default behavior by modifying this variable at the beginning:
$copyEmpty = false; // Change to true if you want to clear tag(s) / comment if the source is empty
Copy tag(s), comment_v0.1.xys
Re: Tag and comment copying
Posted: 01 Nov 2019 14:34
by FKF5482
Is it possible to somehow copy all tags and comments from a selected file in pane 1 to the selected file in pane 2. That would make things a lot easier.
With the current script it's only possible to copy when all files are in the samed folder. Unless of course im missing something and in that case please let me know.
Thanks again

Re: Tag and comment copying
Posted: 02 Nov 2019 00:33
by highend
See this one (v0.2), changelog:
Copy tag(s), comment_v0.2.xys
Re: Tag and comment copying
Posted: 02 Nov 2019 10:47
by FKF5482
Excellent, this will speed things up!
Thank you again Highend

Re: Tag and comment copying
Posted: 13 May 2020 01:23
by VeeGee
Good evening,
After forum searching this thread looks like my question fits into it.
I have dual panes. Source on top, Target on bottom. There are TAGS on the folders in the Source pane. What I'd like to do is, if the folder exists in the Target pane, copy the TAG from the matching Source folder to the Target. No specific selections, just process all the folders in Source and check if it matches in Target, if so, copy the TAG.
I am attempting to script this and am thinking it would go something like this :
1. Get a list of folders in Source
2. Loop through the Source folders and check if a match is found in Target
3. If folder name matches, copy the Source TAG to the Target folder
Is this a good approach to this ? I didn't see any built-in tools to do this, so I assumed it was a job for scripting.
Re: Tag and comment copying
Posted: 13 May 2020 06:36
by highend
Would work. But you don't want to do this in a
Code: Select all
... outer loop over src folders
... inner loop over dst folders
check for a match
...
...
way, right?