Page 1 of 1

How to edit document types for Ctrl+Shift+N

Posted: 11 Dec 2015 04:05
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

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

Posted: 11 Dec 2015 11:24
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).

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

Posted: 12 Dec 2015 23:18
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.

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

Posted: 13 Dec 2015 04:06
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

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

Posted: 13 Dec 2015 04:07
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

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

Posted: 13 Dec 2015 11:23
by admin
Yep, that's an idea for later.

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

Posted: 13 Dec 2015 21:28
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:

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

Posted: 13 Dec 2015 21:33
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! :)

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

Posted: 15 Dec 2015 08:38
by binocular222
Edit > New Items
That you be alot easier, you can edit whatever you want.

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

Posted: 15 Dec 2015 11:57
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.

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

Posted: 15 Dec 2015 22:27
by krakatoa
Thank you SammaySarkar! :appl: :biggrin: :appl:

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

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

Posted: 16 Dec 2015 01:04
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

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

Posted: 16 Dec 2015 08:39
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.

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

Posted: 16 Dec 2015 10:04
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: