Search the Community
Showing results for tags 'ini read issue'.
-
Not sure where to put this one, so I guess here is as good a place as any. I am not sure if it is even strictly an AutoIt question, but it only happens with my AutoIt created programs. I use INI files a lot, have done so for many years. They are quick and simple and ideal most of the time. When necessary I use XML or SQL. Every now and then, not often, I have what appears to be some kind of corruption issue. Over the years it has happened to me at least half a dozen times, perhaps more and perhaps more have gone unnoticed. This is with various programs I have coded. What happens, is that the first entry in an INI file is no longer being read by INI functions. I don't know the cause, but I have found four ways to fix the issue. 1. Put a blank line at the start of the file. NOTE - If I remove that line, it goes back to not working. 2. Copy & paste into another file, and replace the original with that. 3. Use FileOpen, FileRead, FileWrite to create a new file to replace the original with. Some of my programs now have a '/fix' parameter on the command-line, to do this at need, via a program shortcut. 4. Do the same as '3' above but wipe original file and write back to that. I am guessing it is some unprintable character or a header issue maybe. But nothing is obvious or seen when opening in an editor like SciTE. You can delete the first few entries of the file, and the new first entry becomes unreadable via INI functions. Can anyone here definitively say what is happening? If I can prevent this issue, it would be much very appreciated, and you will gain my heartfelt gratitude. The source for some of the INI file entries comes from a calibre XML type 'metadata.opf' file, which I read line by line, rather than bother with XML functions. I only extract from about 6 lines, and unnecessary content at start and end of each line is stripped. Without further ado, here is my latest program, as a script and executable, which I am still developing. Plus the INI file in question - Ebooks.ini. I've also included the 'metadata.opf' file for that first (non-read entry) ebook. Booklist To HTML.zip Just select the first Author List entry shown - A. D. Davies. In the combo control for Titles, you will only see one ebook entry. At the start of the INI file, there are two ebooks listed for that author, and only the second one is the one listed in program. If you create and rename the 'Test.ini' file to 'Ebooks.ini', and use that, you will see that both are now listed. NOTE - You can create a shortcut to the script or EXE file, with the parameter '/fix' and run the program with that to get a fixed file called 'Test.ini'. WARNING - Script is written using AutoIt v3.3.0.0 ... an oldy but a goody. I have tested it with almost the latest version of AutoIt (v3.3.14.2) as well. EDIT Per request of TheDcoder who is on Linux right now. Test.ini