Page 4 of 8

Re: Miscellaneous - Questions

Posted: 02 Aug 2019 23:12
by highend
Remove $2 from that line^^

Re: Miscellaneous - Questions

Posted: 02 Aug 2019 23:21
by MaxEnrik
OMG! No way! I never mind it to remove it. Even didn't pay attention on it.
Thanks a lot.

Re: Miscellaneous - Questions

Posted: 16 Aug 2019 21:40
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);
    }


Re: Miscellaneous - Questions

Posted: 16 Aug 2019 21:49
by highend
And removing the line with the check if it is a folder doesn't come to your mind? oO

Re: Miscellaneous - Questions

Posted: 16 Aug 2019 23:04
by MaxEnrik
I didn't remove it vice versa I tried to add more lines for files. Thanks a lot. Seems works good.

Re: Miscellaneous - Questions

Posted: 18 Aug 2019 02:29
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

Re: Miscellaneous - Questions

Posted: 18 Aug 2019 05:15
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()

Re: Miscellaneous - Questions

Posted: 18 Aug 2019 21:16
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.

Re: Miscellaneous - Questions

Posted: 19 Aug 2019 16:22
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

Re: Miscellaneous - Questions

Posted: 25 Aug 2019 03:17
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);
    }

Re: Miscellaneous - Questions

Posted: 29 Apr 2020 06:36
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]+

Re: Miscellaneous - Questions

Posted: 29 Apr 2020 08:19
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"?

Re: Miscellaneous - Questions

Posted: 29 Apr 2020 10:50
by MaxEnrik
Thank you! It works good.

Re: Miscellaneous - Questions

Posted: 30 Apr 2020 03:23
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?

Re: Miscellaneous - Questions

Posted: 30 Apr 2020 08:57
by highend
return
property()
<cc_item>
+ Concatenation