Hi,
I'm looking to create a simple installer for colleagues which will chain a few other installations and add some PowerShell scripts in order to analyze log files. As part of this I use a custom user defined language within Notepad++, and I believe this is defined as XML. Is it possible to be able to add this within the NSIS script?
Cheers
Chris
Possible to add a Notepad++ User Define Language within a NSIS script?
8 posts
Are you asking how to install a Notepad++ add-on?
No. I'm asking how can I add a User Defined Language to NotePad++, by a NSIS script.
In NotePad++, click Language -> Define you Langage. You can Import and Export, which will save the defined language as an XML file. Somehow, I would therefore need to add this XML file to the right place ("C:\Users\<user>\AppData\Roaming\Notepad++\userDefineLang.xml"), or merge to this file if it already existed.
This is used (in my world) for highlighting specific Log entries, but is a bastardisation of Syntax highlighting etc.
In NotePad++, click Language -> Define you Langage. You can Import and Export, which will save the defined language as an XML file. Somehow, I would therefore need to add this XML file to the right place ("C:\Users\<user>\AppData\Roaming\Notepad++\userDefineLang.xml"), or merge to this file if it already existed.
This is used (in my world) for highlighting specific Log entries, but is a bastardisation of Syntax highlighting etc.
Section
SetOutPath "$AppData\Notepad++"
File "userDefineLang.xml"
SectionEnd Wow
Wow thats great. I didnt realise the File instruction would merge XML file as well as copy them. Obviously, some users will already have User Defined languages contained in the userDefineLang.xml file, so I can't simply copy a file over what is there.
In other cases, users will not have this file, so File will also be able to create a properly XML file based on my language (e.g. log.xml)?
Wow thats great. I didnt realise the File instruction would merge XML file as well as copy them. Obviously, some users will already have User Defined languages contained in the userDefineLang.xml file, so I can't simply copy a file over what is there.
In other cases, users will not have this file, so File will also be able to create a properly XML file based on my language (e.g. log.xml)?
No File will not merge XML.
Put yourself in my shoes, I don't know anything about Notepad++ and you have provided zero information about the XML layout so how am I supposed to know how to insert some data that you also have not told me anything about!
You need to use one of the xml plug-ins to do this...
Put yourself in my shoes, I don't know anything about Notepad++ and you have provided zero information about the XML layout so how am I supposed to know how to insert some data that you also have not told me anything about!
You need to use one of the xml plug-ins to do this...
Hey Anders, honestly I appreciate your help, It is thes reason for posting here in the first place. I certainly could have been more explicit when relating to my XML needs. I thought I had, but I see I haven't.
Bother he userDefineLang.xml simply contains
Bother he userDefineLang.xml simply contains
and the exported language file, simply contain one UserLang element such that it is:<NotepadPlus>
<UserLang name="lang1" ext="exta extb" udlVersion="2.1">
.
.
</UserLang>
<UserLang name="lang2" ext1 ext 2 udlVersion="2.1">
.
.
</UserLang>
</NotepadPlus>
<NotepadPlus>
<UserLang name="lang3" ext="ext1a ext2b" udlVersion="2.1">
.
.
</UserLang>
</NotepadPlus>
Well, I have looked over Wizou's nsisXML 1.4, and I can see to open a single XML file and select a node, but I will also need to to open a second XML file, check to to see if a node exists, then copy one the saved node into the second file if it doesn't exist.
I can't see a simple ways to open multiple XML files and somehow copy nodes between the, or even to a temporary variable.
Will keep looking.
From above here's what I need to do:
1) If the userDefineLang.xml exists then Open the and check to see if the node "lang3" exists
2) If the "lang3" node doesn't exist, then copy the "lang3" node from the second saved XML file to the userDefineLang.xml file
3) if "lang3" node does exist, then modify the node so that it it updated with the the info in the save XML (probably simpler to delete and readd the node)
I can't see a simple ways to open multiple XML files and somehow copy nodes between the, or even to a temporary variable.
Will keep looking.
From above here's what I need to do:
1) If the userDefineLang.xml exists then Open the and check to see if the node "lang3" exists
2) If the "lang3" node doesn't exist, then copy the "lang3" node from the second saved XML file to the userDefineLang.xml file
3) if "lang3" node does exist, then modify the node so that it it updated with the the info in the save XML (probably simpler to delete and readd the node)