For writing data to files. The values which must be set depend on the Type specified below.
Specify the type of file writing which is to be used:
Specify the file in which the modification will be made. This file must exist before any writing will be done. If it does not exist, the [FileWriteN] section will be skipped.
The Value will be written to a line starting with this value, or if it is not found, at the end of the file. This should be set to the text to search for at the start of a line. In an INI-style file, this would be key=, and in an XML file it might be ' <config id="something">'; note that you must include any leading whitespace which will be in the file, and if there is any leading or trailing whitespace you must quote the string with single (') or double (") quotes.
The value which will be written to the file. If dealing with Type=ConfigWrite, you should remember with things like XML files that you will normally need to close the tag, for example %PAL:DataDir%\settings</config>. In such cases you can also try using the inbuilt XML support.
The string to replace the search string with. If, after environment variable replacement, this is the same as the Find string, the replacement will be skipped (e.g. if you use it to update drive letters and it’s on the same letter).
The attribute which will be set inside the element identified by the given XPath. See Dealing with XML data for more details.
Specify the XPath to find the place to write to. It is a good idea to make sure that you have a solid understanding of how XPaths work and how to use them before writing one.
For information about what this should look like, see Dealing with XML data.
Case sensitive searches are somewhat faster than case-insensitive searches. If you can do a case-sensitive ConfigWrite or find and replace, do.
Concerning drive letter updates, you can’t guarrantee what case the drive letter will be and so it will not normally be practical to do a case sensitive replacement for drive letters.
If you need to find and replace in a Unicode (UTF-16LE) file, but it is missing the byte-order mark (BOM), set the encoding here as UTF-16LE; if a file for some reason has the UTF-16LE BOM, U+FFFE, at the start of the file, but isn’t really UTF-16LE, set this to ANSI. Otherwise, omit this value and the encoding will be automatically detected by checking for the BOM.
For UTF-8 files, leave this value out. The value ANSI isn’t really ANSI, it’s just “normal”, which includes ANSI, UTF-8 and really anything which doesn’t use null bytes all over the place.
This value only works with the Type Replace; both ConfigWrite and INI automatically detect the encoding of the file (this requires that the file start with the UTF-16LE BOM, U+FFFE).
Changed in version 2.1: previously ConfigWrite was not able to write to UTF-16LE files.
Enter search terms or a module, class or function name.