How can you make All types (*.*) the default, when saving
-
Can I suggest you read:
https://community.notepad-plus-plus.org/topic/19215/faq-desk-to-add-extensions-automatically-or-not-to-add-extensions-automaticallyI don’t think you will get exactly what you want but you may be able to adapt by using one of the 2 options suggested.
Terry
-
I’m having same issue, I tried terry’s suggestion and it didn’t work
-
The new auto-apply-extensions-in-both-dialog-modes was implemented to make the majority more happy, which had the side effect of making the minority more unhappy.
If you change the syntax highlighter to a User-Defined Language (including Language > User-Defined, which is the dummy UDL that resets every time Notepad++ restarts), then a save or save-as will default to the Save As Type of “All Files (.)”. The User-Defined dummy UDL is also assignable in the Shortcut Mapper: Settings > Shortcut Mapper, choose Main menu tab, type
user
in the Filter, and select User-Defined (in my example, I assigned it toCtrl+Alt+Shift+Up
):
I removed the shortcut for that menu entry, so that I could use that shortcut for a macro instead:
With a bit of experimenting, I was able to record then edit a macro which will do the following steps:
- Create new file (File > New)
- Assign it temporarily to UDL: User-Defined (Language > User-Defined)
- Pop up the Save As dialog, which for me shows
All Files (*.*)
as the filter in this condition. As long as you Save at this point (not Cancel), the macro will continue below: - Type a space and backspace
- Change the type back to Normal text (Language > Normal Text)
- Save it again
I assigned this macro to
Ctrl+Alt+Shift+Up
.Unfortunately, #2 and #6 don’t record in the macro recorder, so I had to manually insert those in the macro. My final macro in
%AppData%\Notepad++\shortcuts.xml
was:<Macro name="CreateAndSaveAs" Ctrl="yes" Alt="yes" Shift="yes" Key="38"><!-- Ctrl+Alt+Shift+Up --> <Action type="2" message="0" wParam="41001" lParam="0" sParam="" /><!-- file | new --> <Action type="2" message="0" wParam="46180" lParam="0" sParam="" /><!-- Language > User-Defined --> <Action type="2" message="0" wParam="41008" lParam="0" sParam="" /><!-- file | save as --> <Action type="1" message="2170" wParam="0" lParam="0" sParam=" " /><!-- type a space --> <Action type="0" message="2326" wParam="0" lParam="0" sParam="" /><!-- backspace: these make it so "save" will work" --> <Action type="2" message="0" wParam="46016" lParam="0" sParam="" /><!-- Language > Normal (IDM_LANG_TEXT) --> <Action type="2" message="0" wParam="41006" lParam="0" sParam="" /><!-- file | save --> </Macro>
If you would like to paste this macro into your
%AppData%\Notepad++\shortcuts.xml
, do the following:- Close all instances of Notepad++
- Run a new instance of Notepad++. Don’t make any other changes not listed in this sequence.
- File > Open
%AppData%\Notepad++\shortcuts.xml
- Paste this macro in the
<Macros>
section - File > Save
- Close this instance of Notepad++
- Start an instance of Notepad++
At this point,
Ctrl+Alt+Shift+Up
should create a New file, run Save As dialog withAll Files
filter, and make sure it’s set to “Normal Text” at the end of the sequence.If you don’t want the File > New, just don’t include the row with the
file | new
comment in the macro.Good luck,
-
Super creative! I wonder if the “easy” fix would be a feature request to just allow User-Defined Lang in the “Default Language” combo box in Settings => Preferences …
Seems if UDF was selected here (it is not actually available in the combo box), then Save As would trigger with “(.) All Files” as it does when you manually select User Defined as the language. Then anyone not liking the new Save As setting could “override” by setting the Default Language to User-Defined in settings.
Comments, thoughts? Perhaps we should rope in more Community “Power Users” for their thoughts before I make a feature request?
Cheers.
-
Interesting idea. The can of worms becomes if they only implemented the single dummy User-Defined UDL, instead of all of the UDL defined for a particular user – if people saw one User-Defined in the dropdown, they’d wonder why they weren’t all listed there. I haven’t looked at the code, but if that pulldown is statically generated (in resource files) rather than dynamically generated, it might be hard to add the UDL, which are dynamic.
-
@Marcel-Abele said in How can you make All types (*.*) the default, when saving:
I’m using different file extension for my files all the time.
I just had another idea for your use-case, @Marcel-Abele: since you always want your different extension, you could edit
%AppData%\Notepad++\langs.xml
, go to the second or so line, which is<Language name="normal" ext="txt" />
and change to
<Language name="normal" ext="mySpecialExtension txt" />
Save
langs.xml
and close Notepad++ (once again, don’t make any other settings changes between the load where you edit this file, otherwise your edit may be overwritten), and re-load the application. The default extension for text files will now be.mySpecialExtension
instead of.txt
.Whichever extension is first in the space-separated list will be the default extension added.
-
This post is deleted! -
@Michael-Vincent
That’s exactly, where I was looking for making a settings change to allow for this.
I definitely support your feature request that works like this.
If using UDF becomes problematic like @Peter Jones mentions, I would like to suggest to add a default language in the drop-down called e.g. “Any”, which copies the formatting of “Normal Text”, but prompts to “All types (*.*)” when saving. -
I could be out of my element here (and perhaps way outside) but mightn’t it be that a lot of the way this Save As stuff functions is because of the way Windows functions?
Meaning that Notepad++ programmers may have limited control over how it all works. Sure, some of it is configurable, but it may just be that it can’t be endlessly customized. Well, I mean, it could, if one were willing to ground-up rewrite the SaveAs functionality, but no one wants to do that, I’m sure.
-
@Alan-Kilborn
Well, I have no idea, if it is Windows related or not. I just know that the save-as function was working to my liking before the update to v7.8.7. So, I think this should be clearly something that can be influenced by the Notepad++ developers.I just want to add: I understand why people (majority or not) may want to have a default setting to be “.txt” for any files they want to save. But it should be possible to override this default setting. As I can see, you can select your default language in the settings, but you can’t select one that doesn’t automatically prompt a specific extension. I find this strange because “no extension” was the previous “default”. But with the latest version it’s all of a sudden not even selectable anymore, which, in my opinion, is a loss of functionality.
-
@Marcel-Abele said in How can you make All types (*.*) the default, when saving:
But it should be possible to override this default setting.
You can override the default extension by just typing it (which is functionally equivalent to the pre-v7.8.7 method, where you had to type the extension)… within limits set by Windows OS. If Windows doesn’t recognize the extension as being “an extension”, Windows will decide to append the
.txt
beyond your manual extension. However, that can be fixed by adding to the<Language name="normal" ext="...">
list in langs.xml: if you haveext="main txt xyzzy"
in that config line, then Normal Text will default to.main
, but if you manually type an extension of.txt
or.xyzzy
or any other extension that your instance of Windows has record of, it will keep that extension. And if you’ve got your fancy.xyzzy
extension registered in Windows to automatically open with Notepad++ (which makes sense that you would, if you think of.xyzzy
files as being text), then Windows has a record of it, and should allow you to manually type that extension, even if it’s not the default extension for Normal Text. (All my experiments have shown that it works that way.)But with the latest version it’s all of a sudden not even selectable anymore
By your definition of “not even selectable”. All you have to do is change a pulldown entry. Or type an extension that Windows accepts. Or edit
langs.xml
. Or use my macro, which you never responded to.If you really insist on an option checkbox to be able to make
All Files (*.*)
the default, then this Forum has an easily-findable FAQ list, which has an entry that explains where to make feature requests. -
@PeterJones
I’m sorry for not replying to your macro.
I’m new to this forum. I would describe myself as a simple user, certainly not a developer.
If I have to write a macro as a workaround for a functionality that previous versions had as a default feature, I think this is certainly over-complicating things. Using workarounds that work with macros, as shown in your post, don’t really work, if you have to change your machine frequently. Every time you jump on another computer, you have to install your macro again. This is just not gonna happen.If I want a workaround, I can always select “All types (*.*)” from the SaveAs dropdown-menu. That still works. It just adds another step, which wasn’t necessary in previous versions.
Also, adding the extensions in langs.xml seems to be excessive. I could add common extensions, I regularly use, but it wouldn’t work with new extensions I might want to choose. Again I would have to fix this on every machine I’m working on, and have to edit this every time I’m creating a new extension.
I totally agree with @Michael-Vincent. I would also call it an “easy fix”, if it was available in the dropdown-menu for default language in the settings.
So, thanks for your replies @PeterJones. I made this post to find out, if there was an easy way to change this that I couldn’t see. But if this is not the case, I will have a look and try to find out, how to make this a feature request.
Thanks for everyone, who replied.
-
Hi, @peterjones,
The new auto-apply-extensions-in-both-dialog-modes was implemented to make the majority more happy, which had the side effect of making the minority more unhappy.
I particularly appreciate your formulation ! Always the same story ;-))
BR
guy038
-
Also said well as:
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
― John LydgateThe attribution is just something found on the internet; decide for yourself if it is accurate – if it matters. :-)
Anyway, how about a different approach on this?: How does one tell Windows that an extension it currently doesn’t know about is one that it SHOULD know about, and then Notepad++ would not append
.txt
(in the default case) to it when saving such a file for the first time? -
@Alan-Kilborn said in How can you make All types (*.*) the default, when saving:
Anyway, how about a different approach on this?: How does one tell Windows that an extension it currently doesn’t know about is one that it SHOULD know about, and then Notepad++ would not append
.txt
(in the default case) to it when saving such a file for the first time?regedit
: RightClick onHKEY_CLASSES_ROOT
in the left pane, New > Key, give it the name of the extension (like.main
or.xyzzy
from my previous examples). That was sufficient to tell Windows that it should know that extension exists. If you also want to make a file association, add a(Default)
value – using(Default)
=txtfile
will make it the same “type” as.txt
under normal circumstances… you can look atHKEY_CLASSES_ROOT\.txt
to see if it still points totxtfile
on your system. -
@PeterJones said in How can you make All types (*.*) the default, when saving:
I haven’t looked at the code, but if that pulldown is statically generated (in resource files) rather than dynamically generated, it might be hard to add the UDL, which are dynamic.
@Alan-Kilborn - thoughts below keep with your “way Windows functions” sentiment - which is true. This just allows users to pick a default file type that equals . rather than *.txt or *.cpp or …
@guy038 - value your opinion as a “power user” on this sight and already chiming in on this discussion.The list I highlight in my above post dynamically generated and purposefully ignores L_USER (which is the default User Defined Language):
size_t index = 0; for (int i = L_TEXT ; i < nppParam.L_END ; ++i) { str.clear(); if (static_cast<LangType>(i) != L_USER) { int cmdID = nppParam.langTypeToCommandID(static_cast<LangType>(i)); if ((cmdID != -1)) { getNameStrFromCmd(cmdID, str); if (str.length() > 0) { _langList.push_back(LangID_Name(static_cast<LangType>(i), str)); ::SendDlgItemMessage(_hSelf, IDC_COMBO_DEFAULTLANG, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(str.c_str())); if (ndds._lang == i) index = _langList.size() - 1; } } } } ::SendDlgItemMessage(_hSelf, IDC_COMBO_DEFAULTLANG, CB_SETCURSEL, index, 0);
I see your point about confusion why not all custom UDLs would be added - and to me (and probably you and other “power users”) it would be obvious - because those custom UDLs are not in the Notepad++ L_* language ID list and they don’t have a build-in parser, etc. But alas, one fix to help those complaining now will lead to others complaining later.
Still, I wonder if an
if ... else
that identifies L_USER and then instead of ignoring it or adding it with its default name “User Defined Language”, it is added to that combo box as “All Files (.)” or “No Default Type”. Of course the Language menu and the bottom left status bar would still show “User Defined Language”, but maybe that would make it less obvious the two are “tied” together and thus squelch the cries for all custom UDLs to be added to the combo box?Comments, thoughts?
Cheers.
-
…
I experimented and verified the following:In Notepad++ v7.8.9-64bit
- I added
HKEY_CLASSES_ROOT\.xyzzy
with(Default)
=txtfile
, and Windows treated it as a text file, and Notepad++ Save As allowed me to type that extension (even when it’s not in thelangs.xml
list) - I added
HKEY_CLASSES_ROOT\.main
with nothing for(Default)
, and Windows didn’t treat it as a text file, but Notepad++ Save As still allowed me to type that extension - I verified
HKEY_CLASSES_ROOT\.magnify
did not exist, and Notepad++ Save As appended.txt
after the.magnify
that I typed.
I then switched to Microsoft Notepad, with the same three entries in my registry:
- Save As
ms.xyzzy
=> createdms.xyzzy
- Save As
ms.main
=> createdms.main
- Save As
ms.magnify
=>createdms.magnify.txt
So the Notepad++ Save As behaves similarly to Notepad Save As with regard to extensions.
—
PS: picked.magnify
because I saw.mag
just before.main
in the registry, so “magnify” popped into my mind, and I knew that.magnify
didn’t exist - I added
-
@Michael-Vincent said in How can you make All types (*.*) the default, when saving:
Still, I wonder if an if … else that identifies L_USER and then instead of ignoring it or adding it with its default name “User Defined Language”, it is added to that combo box as “All Files (.)” or “No Default Type”
That’s a great idea. Thanks for the research.
If we can convince @Marcel-Abele to submit the Feature Request issue, and you chime in with your notes there, you might be able to convince someone (maybe Scott) to add the
else
to the code you quoted. -
I recently said,
Save As
ms.magnify
=>createdms.magnify.txt
Just to make sure there wasn’t a difference between 3-letter extensions and long-extensions, I also tried
ms.max
(checking that regedit didn’t show a.max
key) in Microsoft Notepad, with Save As Type =Text Documents (*.txt)
, and Windows still added the extra.txt
, naming itms.max.txt
.In Notepad, I also went to Save As Type =
All Files (*.*)
, and typedms.max
, and it saved asms.max
without appending.txt
.In Notepad++, the Text type appended .txt so
blah.txt
becameblah.max.txt
, but withAll Types (*.*)
selected,blah.max
becameblah.max
, no extra extension.In other words, the Microsoft Save / Save As dialog behaves identically with regard to type and extension in Microsoft Notepad as it does in Notepad++.
-
@PeterJones said in How can you make All types (*.*) the default, when saving:
In other words, the Microsoft Save / Save As dialog behaves identically with regard to type and extension in Microsoft Notepad as it does in Notepad++.
I did some basic research (read: not as exhaustive and documented as yours) when this feature first was introduced and I was convinced it behaved like Windows notepad.exe. Glad to see proper documented research that upholds my claim.
Still, I think the (perceived) “issue” is that Notepad++ let’s a user pick the default language from a rather exhaustive list (Windows notepad.exe offers “
*.* or *.txt
”) so there is this assumption (right or wrong) that typing any extension will result in “myfile.anyExtension”, not “myfile.anyExtension.txt”.Of course, your research shows that if Windows knows about the extension - even though Notepad++ doesn’t have it in its language list, the assumption proves correct. If however Windows doesn’t know about it (maybe you’re creating your own user-defined file type, maybe you don’t have the program whose file you’re editing installed in your Windows so the filetype was not registered, whatever …) then the assumption proves wrong.
It seems with Notepad++ set to
*.*
then any extension typed, whether Windows knows about it or not results in “myfile.anyExtension” - so making the option to set*.*
as the default would “fix” the (perceived) “issue”. The current combo box just doesn’t have that option now and the easiest way to add it is with L_USER (User Defined Language), but I see the unintended consequences that may arise.Cheers.