Miscellaneous - Questions

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Miscellaneous - Questions

Post by highend »

Remove $2 from that line^^
One of my scripts helped you out? Please donate via Paypal

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

OMG! No way! I never mind it to remove it. Even didn't pay attention on it.
Thanks a lot.

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

I believe this is maybe so easy but still trying unfortunately couldn't done it by myself.
I'd like to below code also could work for files, please.

Code: Select all

    foreach($folder, <get SelectedItemsPathNames |>, , "e") {
        if (exists($folder) != 2) { continue; }
        $base = gpc($folder, "base", -2, 1);
        $newName = replace(regexreplace($base, "^(.*?)(_Male|_Female)(.*?$)", "$1$2"), "_", " ");
        renameitem($newName, $folder);
    }


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

Re: Miscellaneous - Questions

Post by highend »

And removing the line with the check if it is a folder doesn't come to your mind? oO
One of my scripts helped you out? Please donate via Paypal

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

I didn't remove it vice versa I tried to add more lines for files. Thanks a lot. Seems works good.

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

I would like to add '.' to this line but can't and I tried like this '.|_' unfortunately this doesn't work.

Code: Select all

foreach($folder, <get SelectedItemsPathNames |>, , "e") {
    $base = gpc($folder, "base", -2, 1);
    $newName = replace(regexreplace($base, "^(.*?)(.Male|.Female|_Male|_Female)(.*?$)", "$1"), ".|_", " ");
    renameitem($newName, $folder);
}
Real version:
Andrew.Smith65.JaneSmith69.Male.AJ6.1.000158-AWW

Expecting result:
Andrew Smith65 Jane Smith69

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

Re: Miscellaneous - Questions

Post by highend »

Your regexreplace() is wrong (you're matching everthing in front of male/female, not only the dot) and inefficient as well
"^(.*?)(\.|_)(Male|Female)(.*?$)"
".|_"
Yeah, replace would search for that exact string. Does it exists (in your example)? Rather not.
Use replacelist() or another regexreplace()
One of my scripts helped you out? Please donate via Paypal

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

Unfortunately since first time I shared my AHK code lines. Today I need to share it again that it reached over 700 lines most of them I wrote by myself. Yes I remember that we already talked about this.

Image

So since you and @jupe explained well (I believe so) but I really can't write it by myself again and again. Unfortunately this is really so hard and even so bloody hard for me. Two times I tried to study that part of codes in .pdf documentation and it always open when I try to write some code.

I will try it again in next weekend. Thanks a lot.

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

Re: Miscellaneous - Questions

Post by highend »

You can write up to 700 lines in AHK but you're not able to replace a single command in a XY script file?
Doesn't make sense to me
One of my scripts helped you out? Please donate via Paypal

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

This really looks like so easy and so simple but it took a lot of efforts and consumed a lot of times.
So far works good. Thanks a lot for your great explanations, I really highly appreciate that @highend

Hope nothing wrong in this code.

Code: Select all

    foreach($folder, <get SelectedItemsPathNames |>, , "e") {
        $base = gpc($folder, "base", -2, 1);
        $newName = replacelist(regexreplace($base, "^(.*?)(\.|_)(Male|Female)(.*?$)", "$1"), ".,_", " ");
        renameitem($newName, $folder);
    }

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

#1 question

I use below code to clear .ddd in file or folder name. Its last part of the word in the file or folder.

File name: aaa.bbb.ccc.ddd.txt
I am expecting: aaa.bbb.ccc.txt

Folder name: aaa.bbb.ccc.ddd
I am expecting: aaa.bbb.ccc

Code: Select all

    foreach($item, <get selecteditemspathnames>, <crlf>, , "No files selected!") {
        $base = gpc($item, "base");
        $newName = regexreplace($base, "(.(?!.*\.).*(?=))", "");
        renameitem($newName, $item, 1);
    }

#2 question

Why this regex doesn't run? [^\p{L}\d]+

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

Re: Miscellaneous - Questions

Post by highend »

01.

Code: Select all

    foreach($item, <get selecteditemspathnames>, <crlf>, , "No files selected!") {
        if (exists($item) == 2) { $base = gpc($item, "name"); }
        else                    { $base = gpc($item, "base"); }
        $newName = regexreplace($base, "\.[^.]+?$");
        renameitem($newName, $item, 1);
    }
02. Short answer: Because it has no legs?
Long one: Because VB6 doesn't know this expression for the unicode category "letter"?
One of my scripts helped you out? Please donate via Paypal

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

Thank you! It works good.

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

Width/Height of Video/Image - in a single Column

I use Dimensions, Frame Width, Frame Height in a 3 columns so is it possible to combine all of them in a single custom column?

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

Re: Miscellaneous - Questions

Post by highend »

return
property()
<cc_item>
+ Concatenation
One of my scripts helped you out? Please donate via Paypal

Post Reply