How to edit document types for Ctrl+Shift+N

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
krakatoa
Posts: 34
Joined: 16 Feb 2014 22:43
Location: Canada

How to edit document types for Ctrl+Shift+N

Post by krakatoa »

Is it possible to edit the "New Folder" Ctrl+N, and "New Text File.txt" Ctrl+Shift+N dialog panel with user-defined values?

For example, can I add the entry: "New Word.DOC" Ctrl+Shift+W ?

I saw references in xyplorer.ini and deleted the last respective entries, but they still show up on the dialog panel - please see image attached.

Thank you! :D
V.1600.0200
To see the attached files, you need to log into the forum.

admin
Site Admin
Posts: 66746
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: How to edit document types for Ctrl+Shift+N

Post by admin »

Open the XYplorer.ini file and look for this section:

Code: Select all

[NewTemplates]
; Tweak: 3 templates for New Folder default names
Version=1
Folder0=\N\e\w \F\o\l\d\e\r
Folder1=yyyymmdd
Folder2=yyyy-mm-dd
; Tweak: 3 templates for New File default names
File0=\N\e\w \T\e\x\t \F\i\l\e
File1=yyyymmdd
File2=yyyy-mm-dd
NewFolderTemplateIndex=4
Tip: An alternative way to achieve the same with more power is the New Item Menu (check Help).

krakatoa
Posts: 34
Joined: 16 Feb 2014 22:43
Location: Canada

Re: How to edit document types for Ctrl+Shift+N

Post by krakatoa »

Thank you.

I know about New Items Menu but I would like this method to work also:
I can't get this right, can you please provide the XYplorer.ini coding, if possible, thank you!

I would like:

New Folder "NewFolder"
New Folder "20151212" Ctrl+N

New Text File "NewTXT" Ctrl+Shift+N
New Doc File "NewDOC" Ctrl+Shift+W


Note: I deliberately omitted spaces in NewFolder, NewTXT and NewDOC to facilitate renaming - no need to select additional word when renaming.

I see where to change shortcuts in Config, but it seems this is only possible for existing commands.

This is my current coding and results, something does not seem right.

Thank you.
To see the attached files, you need to log into the forum.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: How to edit document types for Ctrl+Shift+N

Post by bdeshi »

@krakatoa
This is my current coding and results, something does not seem right.
You have this:

Code: Select all

File0=\N\e\w \D\o\c\ \F\i\l\e
which should be this

Code: Select all

File0=\N\e\w \D\o\c \F\i\l\e
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: How to edit document types for Ctrl+Shift+N

Post by bdeshi »

@Don, you should allow custom file extensions in New Text File templates, instead of defaulting to txt.

Code: Select all

File1=\r\e\a\d\m\e\.\m\d
makes the menu item be

Code: Select all

Edit | New | New Text File "readme.md.txt"
Perhaps also rename the menu captions to "New File", and include the default txt extensions in the ini so users can customize them:

Code: Select all

File0=\N\e\w \T\e\x\t \F\i\l\e\.\t\x\t
File1=yyyymmdd\.\t\x\t
File2=yyyy-mm-dd\.\t\x\t
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 66746
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: How to edit document types for Ctrl+Shift+N

Post by admin »

Yep, that's an idea for later.

krakatoa
Posts: 34
Joined: 16 Feb 2014 22:43
Location: Canada

Re: How to edit document types for Ctrl+Shift+N

Post by krakatoa »

SammaySarkar wrote:which should be this

Code: Select all

File0=\N\e\w \D\o\c \F\i\l\e
That fixed it, Thanks! :appl:

krakatoa
Posts: 34
Joined: 16 Feb 2014 22:43
Location: Canada

Re: How to edit document types for Ctrl+Shift+N

Post by krakatoa »

SammaySarkar wrote:@Don, you should allow custom file extensions in New Text File templates, instead of defaulting to txt.

Code: Select all

File1=\r\e\a\d\m\e\.\m\d
makes the menu item be

Code: Select all

Edit | New | New Text File "readme.md.txt"
Perhaps also rename the menu captions to "New File", and include the default txt extensions in the ini so users can customize them:

Code: Select all

File0=\N\e\w \T\e\x\t \F\i\l\e\.\t\x\t
File1=yyyymmdd\.\t\x\t
File2=yyyy-mm-dd\.\t\x\t
These were my questions also and please add my votes :tup: :tup: :tup: (3 votes :wink: ) for this request at it seems it has not yet been implemented. Adding the ability to define & create the new file type is helpful such as .DOC.

Thank you! :)

binocular222
Posts: 1424
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: How to edit document types for Ctrl+Shift+N

Post by binocular222 »

Edit > New Items
That you be alot easier, you can edit whatever you want.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: How to edit document types for Ctrl+Shift+N

Post by bdeshi »

the advantage to new item templates is you can assign shortcuts to them.

Come to think of it, krakatoa, you can actually reassign the CTRL+SHIFT+N shortcut to a script that really makes a *.doc file.
Here's how:

Go to Menu > User > Manage commands. Select "Run Command" from the category list at left, hit the INSERT key (or press "New" button > Add New Command).
Now, look at the bottom of the dialog, there are two empty Caption and Script textboxes.
Paste the following script into the Scripts box:

Code: Select all

new(trim(regexmatches(self('caption'),'\"[^\"]*\"$'),'"'),,,'r');
Now, the trick is in the caption. The caption should be in this format

Code: Select all

New File "filename"
So a caption like this

Code: Select all

new File "NewDOC.doc"
will create a new file named "NewDOC.doc". (and focus it in rename mode)
So you can duplicate this command with just a different caption to make a whole different newfile creator.
(Duplicate User-commands: select the command and press CTRL+INSERT or New > Duplicate...)

Now that's setup, go on to shortcut re-assignment. [Press OK to save and close the User Commands manager]
Go to Menu > Tools > Customize Keyboard shortcuts, press the "Jump" button, and find the newly-created user command in the command list that opens (to find faster, type "User | Run Script | " in the searchbox at the bottom-left, followed by the command's caption).
Okay, now select the user command and press OK, then press the desired shortcut (CTRL+SHIFT+N) and press "Assign" followed by "OK".

From now on, CTRL+SHIFT+N will not create a NewDOC.txt, but a NewDOC.doc (or whatever you have in the user-command's caption)
And remember, you can repeat the process, just tweak the caption line, to make a different newfile creator.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

krakatoa
Posts: 34
Joined: 16 Feb 2014 22:43
Location: Canada

Re: How to edit document types for Ctrl+Shift+N

Post by krakatoa »

Thank you SammaySarkar! :appl: :biggrin: :appl:

Clear and easy to follow. I will try it this weekend.

krakatoa
Posts: 34
Joined: 16 Feb 2014 22:43
Location: Canada

Re: How to edit document types for Ctrl+Shift+N

Post by krakatoa »

I just tried it and successfully created two scripts:

Code: Select all

 New File "New.txt"   [Shift+T]
and

Code: Select all

 New File "New.doc"   [Shift+W]
[Shift+D] might make more sense and it shows as a Free Keyboard Shortcut, but in Windows this combo bypasses the Recycle Bin when deleting a file - very dangerous, IMHO, Alt+D also shows as available, but I think I will avoid "+D" altogether :wink: .

Nice work SammaySarkar :D :D :D

admin
Site Admin
Posts: 66746
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: How to edit document types for Ctrl+Shift+N

Post by admin »

SammaySarkar wrote:@Don, you should allow custom file extensions in New Text File templates, instead of defaulting to txt.

Code: Select all

File1=\r\e\a\d\m\e\.\m\d
This will work as expected in the next version.

However, I have to keep the "New Text File" caption for other reasons. So it's kind of an under cover feature.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: How to edit document types for Ctrl+Shift+N

Post by bdeshi »

admin wrote:This will work as expected in the next version.
yay! :tup: :tup:
krakatoa wrote:[Shift+D] might make more sense and it shows as a Free Keyboard Shortcut, but in Windows this combo bypasses the Recycle Bin when deleting a file
No, SHIFT+DELETE bypasses recycle bin.
krakatoa wrote:Nice work SammaySarkar :D :D :D
thank you! :kidding:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply