Language type same as defined type but with different file extension
-
I am using a program that allows you to script serial port communications (the program is Docklight Scripting). It has been very useful for me as a firmware developer needing to communicate over serial com ports.
It has the ability to do scripting. This is used to script responses to messages my firmware sends off a piece of hardware we are developing or to script command messages to slave nodes and process the response messages.
The scripting language is VB scripting but they save the files with the extension .pts instead of .vb or .vbs.
I tried setting up Notepad++ to recognize .pts as a .vb script. I did get it correct that when I browse to a file with .pts extension and open it, that it uses the VB language text color encoding and font settings in the editting window.
However if I do a save as of the same file to another file name it changes the extension to .vb instead of leaving it as .pts. How do I get it to save it as .pts and still realize that is a VB style script?
-
@Jim-Woodward said in Language type same as defined type but with different file extension:
I tried setting up Notepad++ to recognize .pts as a .vb script. I did get it correct that when I browse to a file with .pts extension and open it, that it uses the VB language text color encoding and font settings in the editting window.
As you implied, Settings > Style Configurator > VB/VBS, setting User ext.: to
pts
will enable Notepad++ to recognize.pts
files as VB for syntax highlighting. (Made it explicit, in case future people searching were looking for the first half of the answer, rather than the second half.)However if I do a save as of the same file to another file name it changes the extension to .vb instead of leaving it as .pts. How do I get it to save it as .pts and still realize that is a VB style script?
There are two versions of the save/save-as dialog, which Notepad++ cleverly calls “old style” vs “new style”. See documentation for Settings > Preferences > Default Directory, which says,
☐ Use new style dialog (without file extension feature & Unix style path capacity): Windows allows for two styles of open/save dialogs.
-
“old style” has “Quick Access”, “Desktop”, and others as icon-buttons along the left; it will auto-apply the selected file-type’s extension to the file (so typing a filename of blah when a file type of “Normal text file (.txt)” is selected will save blah.txt); it will also allow using Unix-style backslashes as a path separator, rather than Windows-style forward slashes.
-
“new style” does not have the icon-buttons (instead, Windows presents those in the tree, similar to other drives and folders); even when a file-type is selected, the user is required to specify the desired file extension (thus the file-type selector is primarily for filtering what existing files are listed in the directory listing); and it will not understand Unix-style backslashes as path separators.
Because both dialogs are windows-supplied dialogs, there isn’t an easy way to change the list of file-types-and-extensions for the old-style. I highly recommend using the new-style dialog, which will allow you, the user, to determine the appropriate extension for a given file, rather than taking the first extension for the given “type” in the drop-down box. This helps both in a case like yours (where the builtin list doesn’t include your custom extension), but also in the more global case where someone wants to Save As a
C++ Source File
, and it defaults to naming it.h
, because that happened to be first in the list!Of course, with the new-style dialog, you have to type 2-4 more characters when naming the file (depending on the extension you want), but since the old-style windows dialog gives the wrong extension anyway in many circumstances, it’s better to choose the one that will always give the extension you want.
(The other thing to make sure is that Windows Explorer is set up to not hide extensions, otherwise, you may get confused when the extension “disappears” after you’ve saved.)
-