I would like to be able to assign a key, such as the 'insert' key as a hotkey that would create a new subfolder in the currently selected folder. Does this functionality aready exist and I simply havent found it in the help system?
Any suggestions are appreciated.
creating hot key to add new folder
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: creating hot key to add new folder
E.g.:
Save it in your script dir (e.g. as "NewFolder.xys"), create a new user defined command
(via Menu - User - Manage Commands... - Load Script File) and assign a keyboard shortcut to it.
If the current selected item is a folder, it will create a new folder inside it, otherwise a new folder in the current directory.
If the dialog window is cancelled, nothing will be created.
Code: Select all
$folderName = input("Name of the new folder:", , "New Folder", "s");
if(exists("<curitem>") == 2) {
if($folderName != "") {
new("<curitem>\$folderName", "dir");
} else {
end(true);
}
} else {
new("<curpath>\$folderName", "dir");
}(via Menu - User - Manage Commands... - Load Script File) and assign a keyboard shortcut to it.
If the current selected item is a folder, it will create a new folder inside it, otherwise a new folder in the current directory.
If the dialog window is cancelled, nothing will be created.
One of my scripts helped you out? Please donate via Paypal
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: creating hot key to add new folder
I understood that he simply wants to assign INS to "New Folder". In that case:
To see the attached files, you need to log into the forum.
FAQ | XY News RSS | XY X
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: creating hot key to add new folder
Selected folder sounds like: The folder that is currently highlighted and not "the folder I'm in". At least to methat would create a new subfolder in the currently selected folder
One of my scripts helped you out? Please donate via Paypal
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: creating hot key to add new folder
Yes, also. It could be both. Only Mac can tell.
FAQ | XY News RSS | XY X
-
Mac
- Posts: 5
- Joined: 15 Feb 2013 18:59
Re: creating hot key to add new folder
I want to start by thanking both of you for your suggestions. I have only been using XYplorer since version 11.90 and am still learning a lot about just what this program is capable of. I know that I am just starting to scratch the surface.
I started with highend's method.
I copied the scipt using copy and past into the file:
C:\Program Files (x86)\XYplorer\Scripts\NewFolder.xys
I then used Menu - User - Manage Commands and assigned the key to it.
When I place the cursor in a folder, or highlight a folder and press the hotkey (Ins) I get this:
[img]C:\!%20Temp\New%20Picture.png[/img]
When I click Continue, the pop-up disappears and nothing else happens.
If I right click on the "Continue Button" and select copy script, I get this:
// NewFolder.xys
load "C:\Program Files (x86)\XYplorer\Scripts\NewFolder.xys","New Folder";
I am not sure what I might have done wrong. Your instructions were very clear, but obviously I did something wrong. I am not a programmer of any kind myself, so I appraciate yout help.
I would like to see how this works in comparison to admins' response.
Using thiat method did allow me to reset the hot key used to create a new folder.
Getting the script to work would be nice. I could then use that to begin a learning process.
Again thank you both for your efforts.
-Mac
I started with highend's method.
I copied the scipt using copy and past into the file:
C:\Program Files (x86)\XYplorer\Scripts\NewFolder.xys
I then used Menu - User - Manage Commands and assigned the key to it.
When I place the cursor in a folder, or highlight a folder and press the hotkey (Ins) I get this:
[img]C:\!%20Temp\New%20Picture.png[/img]
When I click Continue, the pop-up disappears and nothing else happens.
If I right click on the "Continue Button" and select copy script, I get this:
// NewFolder.xys
load "C:\Program Files (x86)\XYplorer\Scripts\NewFolder.xys","New Folder";
I am not sure what I might have done wrong. Your instructions were very clear, but obviously I did something wrong. I am not a programmer of any kind myself, so I appraciate yout help.
I would like to see how this works in comparison to admins' response.
Using thiat method did allow me to reset the hot key used to create a new folder.
Getting the script to work would be nice. I could then use that to begin a learning process.
Again thank you both for your efforts.
-Mac
To see the attached files, you need to log into the forum.
-
RalphM
- Posts: 2143
- Joined: 27 Jan 2005 23:38
- Location: Cairns, Australia
Re: creating hot key to add new folder
I didn't test it myself but it seems your call of the script has a parameter "New Folder" and with the provided script that doesn't work.
And just to make sure please check, that the first line of your script is indented!
And just to make sure please check, that the first line of your script is indented!
Ralph 
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
-
Mac
- Posts: 5
- Joined: 15 Feb 2013 18:59
Re: creating hot key to add new folder
It does appear that all lines are indented 3 spaces.
I have attached it so you can look at it. I used notepad to create is a txt file and then renamed the extension to .xys.
I have attached it so you can look at it. I used notepad to create is a txt file and then renamed the extension to .xys.
To see the attached files, you need to log into the forum.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: creating hot key to add new folder
That's ok.It does appear that all lines are indented 3 spaces
RalphM already posted the solution. You're calling the script with a specific label:
Code: Select all
load "C:\Program Files (x86)\XYplorer\Scripts\NewFolder.xys","New Folder";Code: Select all
load "C:\Program Files (x86)\XYplorer\Scripts\NewFolder.xys";One of my scripts helped you out? Please donate via Paypal
-
Mac
- Posts: 5
- Joined: 15 Feb 2013 18:59
Re: creating hot key to add new folder
That did the trick. Blanking the 'Label:' field in Manage User Defined Commads made it run perfectly.
The script method was exactly what I was looking for.
I want to again Thank everyone who helped!
Really great program. Wish I had found it much earler!
The script method was exactly what I was looking for.
I want to again Thank everyone who helped!
Really great program. Wish I had found it much earler!
XYplorer Beta Club