Comments in ini files


















The comments are all left in place Example: GameUserSettings. All four tests above save correctly, throw no errors, and remain after rebooting the server That's good news. It must have been changed in an update. I tried about dozen different delimiters and comment syntax before i gave up on it.

Per page: 15 30 Date Posted: 14 Apr, pm. Posts: 5. Discussions Rules and Guidelines. Also please remove any links you may have to my website. If I posted any code, assume that code was written using the latest release version unless stated otherwise.

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude How to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.

If you do use my code all I ask, as a courtesy, is to make note of where you got it from. This will also work for comments on a separate line but I can see it becoming a nightmare if there are any additions to the file at some point. It could also be done if you don't specify the key but that requires a small fix after the file is written.

I should have mentioned that if you are using the inline method the semi-colon must follow a whitespace. Having the comments all mixed up with the settings just seems confusing. Better for documentation if I could put several lines just above a section. Someone else may come up with an alternative yet. Actually I just though of another possibility as long as you know all the section names in advance. Create a template with everything there including the section names then just use the standard functions to add the values.

Yeah, seems like it would be easier to just write the file using the normal write line functions. It just seems weird that there would be a delay flushing the file. That's the only reason I can think of why the hybrid approach was not dependable.

It's only AutoIt3 that I got the corruption. I wonder if there's some issue with file flush in one of the libraries. Especially since I called flush on the file handle before closing, then closed it, then waited, you'd think then running the ini file functions wouldn't be a problem. Just forces me to load an array in the proper sequence to get what I want into the file.

It would just be easier for working code that already writes out a bunch of settings not to make changes. I knocked up a function that should do what you're looking for as far as commenting a section in an ini file. See the code below, it includes error checking as well as the ability to add the comments before or after the section name. Note that when adding a comment to the ini file, if you are adding it before the section name, it will start at the line just before the section name then inserts the comments, then adds the section name and the rest of the ini file's contents.

If adding a comment to a section after the section name, it will start at the next line after the name, insert the comments, and then the rest of the ini file's contents. AutoHotkey Forums Members. Facebook Twitter. Javascript Disabled Detected You currently have javascript disabled.

Comments in. INI files? Started by Lemming , May 10 AM. Please log in to reply. Something like: ; Do not change any of these values. Some of my scripts use. INI files, and I do include documentation with them, but it would be good to add comments to the.

INI files themselves. I put comments in my configuration.



0コメント

  • 1000 / 1000