Page 1 of 1

"create new folder" with predefined name from existing folder ??

Posted: 27 Mar 2022 12:33
by frany
For creating a new folder XY provides quite some options.
Nevertheless I really miss one feature (which in my early days of using NC was extremly handy):

The name of the marked folder (in the folder list / tree of a pane) should be used as the name for the newly created folder (via e.g. CTRL+N) instead of the usual "New Folder" ("Neuer Ordner").

Very often I just need to change a detail in the wording of the foldername and I am done.
In the current setting I need to completely type the new name, or do an additional copy/paste from the other folder name.

I thought to ask here if someone had that issue and found a solution before I go to the "wishes" section.

And yes, I tried my best to search the forums before I asked (and I am not good at coding, to try my own bypass).

Thanks!

Re: "create new folder" with predefined name from existing folder ??

Posted: 27 Mar 2022 13:10
by highend
Remove CTRL+N from "New Folder" in Menu - Tools - Customize Keyboard Shortcuts
1.png
1.png (14.54 KiB) Viewed 715 times
Menu - User - Manage Commands...

Category: Run Script
Create a new entry
Caption: New folder
Script: (Use the "Edit..." button)

Code: Select all

    $default = "Neuer Ordner";

    $focus = <get focusedcontrol>;
    if     ($focus == "T") { $folderName = <curfolder>; }
    elseif ($focus == "L") {
        if (exists(<curitem>) != 2) { $folderName = $default;  }
        else                        { $folderName = <curname>; }
    }
    $new = input("Enter new folder name...", , $folderName, "e", 8:=":newfolder");

    end (!trim($new)), "Can't create an empty folder name, aborted!";
    end (exists($new) == 2), "A folder with that name already exists, aborted!";

    new($new, "dir");
After clicking OK in the "Edit Script" window, click on "Assign Keyboard Shortcut..." and assign... CTRL+N
2.png
2.png (12.39 KiB) Viewed 715 times

Re: "create new folder" with predefined name from existing folder ??

Posted: 27 Mar 2022 13:19
by frany
well, this is something .... Working.
you made my day! and these steps give me ideas :)
THANKS highend!