Append labels (as words) and tags to file names (selected)

Discuss and share scripts and script files...
highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Append labels (as words) and tags to file names (selected)

Post by highend »

Em, you've read label + tags. Use them!

Your version would make this:

Code: Select all

[Fancam] 100522 Sunny SNSD - Intro+Run Devil Run.mp4
out of this:

Code: Select all

[Fancam] 100522 Sunny SNSD - Intro+Run Devil Run [ENG SUB] [Blue; distorted heavily].mp4
Deleting [ENG SUB]...

And you don't need to get the extension, renameitem() takes care of this automatically
One of my scripts helped you out? Please donate via Paypal

AugerJ
Posts: 50
Joined: 19 Jul 2016 06:27

Re: Append labels (as words) and tags to file names (selected)

Post by AugerJ »

After the script has read the label and the tags,
it needs to rewrite the next part of the file name:
" [From Label; From Tags]"
and then delete that part, right?

Or a script could use the file name alone,
locate that part and delete it,
which seems simpler.

Either way, at some point the script should

Code: Select all

Delete [<label name>;<tag>]
or something like that.
I'm not familiar with the "script" language so I can only guess how it should look
after the script finds the part in question:

Code: Select all

    end (compare(<xyver>, "18.00.0021", "v") == -1), "You need at least v18.00.0021 of XYplorer, aborted!";

    $labels = regexmatches(readfile("<xydata>\tag.dat", , 2000), "^((.+?)\|([A-F0-9]{6})?\|([A-F0-9]{6})){7,}$");
    $labels = trim(regexreplace($labels, "\|([A-F0-9]{6})?\|[A-F0-9]{6};?", "|"), "|");

    foreach($file, <get "SelectedItemsPathNames" <crlf>>, <crlf>, "e") {
        // Ignore folders
        if (exists($file) == 2) { continue; }

        // Find [<label name>;<tag>]

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Append labels (as words) and tags to file names (selected)

Post by highend »

Don't know what you're doing there...

Code: Select all

    end (compare(<xyver>, "18.00.0021", "v") == -1), "You need at least v18.00.0021 of XYplorer, aborted!";

    foreach($file, <get "SelectedItemsPathNames" <crlf>>, <crlf>, "e") {
        if (exists($file) == 2) { continue; }

        $label = tagitems("label", , $file, 2);
        $tags  = tagitems("tags", , $file);

        if (!$label && !$tags) { continue; }
        $newName = replace(gpc($file, "base"), " [$label; $tags]");
        renameitem($newName, $file);
    }
One of my scripts helped you out? Please donate via Paypal

AugerJ
Posts: 50
Joined: 19 Jul 2016 06:27

Re: Append labels (as words) and tags to file names (selected)

Post by AugerJ »

Thanks.

tlkillen
Posts: 1
Joined: 18 Jul 2019 16:35

Re: Append labels (as words) and tags to file names (selected)

Post by tlkillen »

Is there a way to do the same thing for folders instead of files?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Append labels (as words) and tags to file names (selected)

Post by highend »

Instead or too?

Instead:

Code: Select all

if (exists($file) == 1) { continue; }
Too:
remove that line or comment it out...
One of my scripts helped you out? Please donate via Paypal

Post Reply