I need to autodetect 'perl wrapped in batch file' file type
I need a way to have NPP determine the file type by examining the first couple of lines in the file to be opened.
I have several Perl scripts that run under MSDOS that are wrapped in BATCH file commands, so the filename extension is .BAT, but the file type is Perl source.
I can distinguish a .BAT file from a Perl file wrapped in a .BAT file by looking at the second line. This line always has a Perl command invocation.
If there were a set of editable rules that define methods for determining a file type, I could say something like this:
"Look at the second line and if it contains "perl", it's a Perl source file"
If you need more details, I can provide them.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As I understand things though, the file type detection is solely done by file extension. You could always manually change the language when you open the file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I need to autodetect 'perl wrapped in batch file' file type
I need a way to have NPP determine the file type by examining the first couple of lines in the file to be opened.
I have several Perl scripts that run under MSDOS that are wrapped in BATCH file commands, so the filename extension is .BAT, but the file type is Perl source.
I can distinguish a .BAT file from a Perl file wrapped in a .BAT file by looking at the second line. This line always has a Perl command invocation.
If there were a set of editable rules that define methods for determining a file type, I could say something like this:
"Look at the second line and if it contains "perl", it's a Perl source file"
If you need more details, I can provide them.
This is very clear.
As I understand things though, the file type detection is solely done by file extension. You could always manually change the language when you open the file.