Miscellaneous - Questions

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
MaxEnrik
Posts: 80
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik » 20 May 2019 23:09

I give up, thanks.

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

Re: Miscellaneous - Questions

Post by highend » 20 May 2019 23:21

Answering the question would have been better...

Code: Select all

renameitem(gpc(<curpath>, "file") . <clipboard>, <curpath>);
No $parent...^^
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

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

Re: Miscellaneous - Questions

Post by MaxEnrik » 20 May 2019 23:40

You ^^. Now I can :biggrin:
I just need to mention, I started off to use ahk after 3 days @jupe mentioned about that. And today 254 lines of code.

Image

But I didn't wrote down single line code in XY by myself. That is terrible, huge consuming of time but even no single line of code.
Unfortunately, I absolutely don't understand XY scripting until today.

Thanks a lot, ^^

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

Re: Miscellaneous - Questions

Post by highend » 20 May 2019 23:51

XY is (like AHK) a scripting language. Don't see any difference there.

It just makes no sense to try to rename the parent of the current path when you actually want to rename the current path.

Programming is about logic. The rest is help file reading and statement construction. AHK is in no way easier than XY (and
I know what I'm talking about, I'm using AHK for years as well)...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

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

Re: Miscellaneous - Questions

Post by MaxEnrik » 21 May 2019 00:06

This is time I spent for my currently issue, and I spent my time in the help.pdf and tried study your script (before you helped me) because it is similar issue.

Image
(mini - is meaning tree)

I hope I will write down next script by myself. (I will celebrate it, IF I will do it)
Thanks a lot, sir. Highly appreciate that.

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

Re: Miscellaneous - Questions

Post by MaxEnrik » 26 May 2019 12:50

#4 Creating Incremental Folders

Image

My goal to Create 10 Folders.
Selected Folder name: `Prefix-120-`
Need to Created Folders will look like this:

  • 01. Prefix-121-
    02. Prefix-122-
    03. Prefix-123-
    ...
    10. Prefix-130-
All code source from @highend
I just give it a try to achieve my goal.

Code: Select all

    $dstPath = <curpath>;
    $subFolders = "Folder-121-|Folder-122-"; ' No idea for incremental folder names

    $folderName = gpc(<curitem>, "component", -2, 1);
    if ($folderName)
    {
        foreach($subFolder, $subFolders, , "e")
        {
            new("$dstPath\$folderName\$subFolder", "dir");
        }
    }
I am just laughing my scripting knowledge. :titter:
But still trying...

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

Re: Miscellaneous - Questions

Post by highend » 26 May 2019 12:58

Mh?

Give a real world example, so that I can see what the real prefix is and if there comes anything after
Prefix-<number>-
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

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

Re: Miscellaneous - Questions

Post by MaxEnrik » 26 May 2019 13:11

Something like below. And only words no `Symbols, `Numbers in this case.
Prefix is:
  • Sport
    Medical
    Health
    Do Fitness
(I used simple `Prefix because no complex `Named at first part of names)

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

Re: Miscellaneous - Questions

Post by highend » 26 May 2019 13:16

What does such a folder name now has to do with what you requested before?

Can you be a bit more damn specific? oO
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

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

Re: Miscellaneous - Questions

Post by MaxEnrik » 26 May 2019 13:35

Sorry. I don't understand your 1st question.

Currently real Folder Name is in my Drive: Medical-012-
So my goal to write a script to create 10 folders.
Medical-013-
Medical-014-
Medical-015-
Medical-016-
Medical-017-
Medical-018-
Medical-019-
Medical-020-
Medical-021-
Medical-022-

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

Re: Miscellaneous - Questions

Post by highend » 26 May 2019 13:37

Code: Select all

    $howMany = 10;

    $base     = gpc(<curitem>, "file");
    $startNum = trim(regexmatches($base, "-\d+?-"), "-");

    while ($i++ < $howMany) {
        $inc = "-" . ($startNum + $i) . "-";
        $newName = regexreplace($base, "-\d+?-", $inc);
        new($newName, "dir");
    }
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

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

Re: Miscellaneous - Questions

Post by MaxEnrik » 26 May 2019 14:12

Thanks a lot man.

Just needed to do by myself, but I only found this `<#001> don't know how to combine it with this script to achieve my goal.
So problem is missing `0/zero as you see in the screenshot.
Is there a chance to do it like this? `013, 014, ..., 022

Image

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

Re: Miscellaneous - Questions

Post by highend » 26 May 2019 14:14

Look up the format() command to get such a padding
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

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

Re: Miscellaneous - Questions

Post by MaxEnrik » 26 May 2019 14:19

Wow, it worked. Thanks.

Code: Select all

        $inc = "-0" . ($startNum + $i) . "-";
Is this method right?

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

Re: Miscellaneous - Questions

Post by highend » 26 May 2019 14:20

No, it isn't. I said "look up the format() command"...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

Post Reply