W3bMa5t3r Posted March 3, 2007 Share Posted March 3, 2007 Hey guys, I've been bashing my head against the wall for the past couple of hours, but apparently I can't seem to figure out arrays and variables for this instance even though I've written a few working scripts/programs (though bashing my head on the wall probably isn't helping... lol). Anywho... I"m trying to read a file layout like such overspeed=80 scrollmode=1 builtinvideo=true disableinternat=true locale=0 hidetaskbar=false hidedesktop=false radiomode=0 radioline=0 lazytag=false allowallfreqs=false browsertype=0 The lines change order constantly so I can't do a line count, to just jump to the setting and value I need to read/write from/to. Also not every file has the same settings, but do have the majority of the same. If anything some will have more. I will only edit the settings common to all the files. I tried the readfile to array bit, which I'm able to do, but once it's in an array, I need to split each string/array (splitstring) at the "=" and have both the setting and value written to additional strings/arrays to be edited by a gui (got that part down)... with that part... I'm clueless apparently. Any assistance would be greatly appreciated so as to prevent further damage of my wall Cheers... Link to comment Share on other sites More sharing options...
BugFix Posted March 3, 2007 Share Posted March 3, 2007 I don't understand, where a problem is. Write your settings in an INI-file. All about this you'll find in autoit help. Best Regards BugFix Link to comment Share on other sites More sharing options...
W3bMa5t3r Posted March 3, 2007 Author Share Posted March 3, 2007 I don't understand, where a problem is.Write your settings in an INI-file. All about this you'll find in autoit help.I've used ini files quite a bit in the other scripts I've writtin, but this... It's not a standard INI file. There are no 'sections' and the lines change with each edit or use by the main program. The only thing that is consistent is "setting=value". The number of settings can also be different from system to system.Unless... can you not have a section? .. lol I didn't try that. would it just be ""? Link to comment Share on other sites More sharing options...
W3bMa5t3r Posted March 3, 2007 Author Share Posted March 3, 2007 (edited) I've used ini files quite a bit in the other scripts I've written, but this... It's not a standard INI file. There are no 'sections' and the lines change with each edit or use by the main program. The only thing that is consistent is "setting=value". The number of settings can also be different from system to system.Unless... can you not have a section? .. lol I didn't try that. would it just be ""?Nope, that didn't work... but what if I had the script open the file, write in a 'section' name at the beginning of the file. that would make the script read everything as keys in an ini file and once I'm done and have written everything back, I can delete the section name from the file and close it out... good idea? Edited March 3, 2007 by W3bMa5t3r Link to comment Share on other sites More sharing options...
jefhal Posted March 3, 2007 Share Posted March 3, 2007 Anywho... I"m trying to read a file layout like such overspeed=80 scrollmode=1 builtinvideo=trueWhy not use _arraySearch? That returns the numeric location of the searched string. YOu then set your variable = the text in that location. To extract the values on either side of the "=" sign, just use any combination of the string functions (left, right, mid, trimleft, etc...) That way you don't have to write any files and I believe this would be faster than using ini files (2 or 3 microseconds?)... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 3, 2007 Share Posted March 3, 2007 Just add a section at the top called everything. INI will work no matter what order items are in. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 3, 2007 Moderators Share Posted March 3, 2007 I've used ini files quite a bit in the other scripts I've writtin, but this... It's not a standard INI file. There are no 'sections' and the lines change with each edit or use by the main program. The only thing that is consistent is "setting=value". The number of settings can also be different from system to system.Unless... can you not have a section? .. lol I didn't try that. would it just be ""?http://www.autoitscript.com/forum/index.ph...st&p=301009 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
W3bMa5t3r Posted March 3, 2007 Author Share Posted March 3, 2007 (edited) Thanks guys for the tips. Looks like I'm going with writing in the [everything] section, using in the info as a regular/real ini file and then writing the info back to the file, and deleting the first line which is the [everything] section line. Cheers Edited March 3, 2007 by W3bMa5t3r Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now