Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

INI Library - FAST in memory functions NO REGEX


  • Please log in to reply
48 replies to this topic
Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010

Cool, have you thought about having Lexikos integrating your "better" INI methods into the main Autohotkey? Are there any disadvantages to using your methods instead of the default IniRead and IniWrite provided by Autohotkey? If not - then lets have Autohotkey use these by default in IniRead and IniWrite!

 

This method over the built in ones have much more overhead if you're just reading a few settings out of a file. This library is built to handle large files where you're doing complex things with it (100+ settings).

 

It could be better implemented through a class in AHK_L but I don't have the time to work on that.



Verdlin
  • Members
  • 256 posts
  • Last active: Apr 29 2016 06:46 PM
  • Joined: 21 Dec 2012

There are certain disadvantages, and they are all listed in the initial post. This library is fast, indeed, but I found the restrictions to be too harsh for my use; this is probably because I do not have a need for enormous inis. If you are interested in alternatives, be sure to check out EasyIni.


Scripts are written and tested using AHK_H 64w (unless otherwise specified).

CFlyout. EasyIni. Dynamic Label Execution (No Reload). Word Lookup.


BGM
  • Members
  • 199 posts
  • Last active: Jun 05 2015 06:26 PM
  • Joined: 12 Jan 2011

Thanks, y'all for your advices!


(AutoHotkey 1.1.15.00 on Windows 7 Pro x64)


Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010

I haven't decided if I want to take the time to do this yet but:

 

 

Is anyone else interested in a version of this library that removes the following limitations while having less than a 0.1% impact on performance?

 

Section and Key names are limited to letters, numbers and the following punctuation: # _ @ $ and space
Reference_Number + Section names cannot exceed 233 characters total.
Reference_Number + Section + Key names cannot exceed 243 characters total



djvj
  • Members
  • 70 posts
  • Last active: Jul 22 2016 02:54 AM
  • Joined: 19 Sep 2010

I want to use this library, but the fact that it limits the ability to use characters in the sections/keys makes it impossible for me to use. It errors out on so many of my sections.

 

If you can make this happen, I would be much appreciated.

 

So far I would need: - (dash) $ (dollar sign) . (period) _ (underscore) () (parenthesis) [] (brackets) , (comma)

 

Spaces seem to work ok already.



Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010

I want to use this library, but the fact that it limits the ability to use characters in the sections/keys makes it impossible for me to use. It errors out on so many of my sections.

 

If you can make this happen, I would be much appreciated.

 

So far I would need: - (dash) $ (dollar sign) . (period) _ (underscore) () (parenthesis) [] (brackets) , (comma)

 

Spaces seem to work ok already.

 

I've got the library over half way modified to fix all of that. I should have it ready within a day or two. I'll post here again when I think it's functional.



A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Is storing inline comments in inis right. (http://en.wikipedia.org/wiki/INI_file)

Take a look at these two gists..

https://gist.github.com/anonymous/5678356

OR

 

AND 

 

https://gist.github....i-Aryan/5678179

OR

 

The commented lines are syntax highlighted as grey

 

Well, another thing

I did this using your function...

RIni_Read_HE(1,"black.ini")
MsgBox % RIni_GetSectionKeys_HE(1,"section1")
msgbox,% RIni_GetKeyComment_NE(1,"section1","exepathname") ;gives me blank

where the "black.ini" was nothing but the 2nd correct gist. Why I get a blank return in 2nd Msgbox.

Ideas ??


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010

Because those comments are on a line by themselves they are tied only to the section and not the keys.

 

If you want to get them you would use RIni_GetSectionLLComments(). If you want to tie the comments to the keys you would need to put them on the same line like this:

 

Key 1=My Value ;This part is the comment



djvj
  • Members
  • 70 posts
  • Last active: Jul 22 2016 02:54 AM
  • Joined: 19 Sep 2010

I've got the library over half way modified to fix all of that. I should have it ready within a day or two. I'll post here again when I think it's functional.

 

Thank you very much, can't wait to try it out once it's complete!



Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010

Updated to 1.6

 

  • Removed the name/length restrictions on section and key names
  • Merged the 2 versions of the library due to the above change there was no practical difference: now there's just one RIni 1.6


djvj
  • Members
  • 70 posts
  • Last active: Jul 22 2016 02:54 AM
  • Joined: 19 Sep 2010

So far it's working, but I have a lot of work and testing left to do till I can say it works for all my scenarios.

 

Thank you.



djvj
  • Members
  • 70 posts
  • Last active: Jul 22 2016 02:54 AM
  • Joined: 19 Sep 2010

So far it has worked on everything I have thrown at it, great job Rseding.

 

One small issue. Reading sections and keys are case sensitive. So if I want to read an ini with a section [PATH] and I set it to look for [Path], it would fail to find it. Is there a way I can turn this off?

 

I see nothing in the documentation mentioning this limitation or intention. So it may have gone unnoticed.



Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010

So far it has worked on everything I have thrown at it, great job Rseding.

 

One small issue. Reading sections and keys are case sensitive. So if I want to read an ini with a section [PATH] and I set it to look for [Path], it would fail to find it. Is there a way I can turn this off?

 

I see nothing in the documentation mentioning this limitation or intention. So it may have gone unnoticed.

 

 

Nice catch :) I updated it to fix that (I think).



djvj
  • Members
  • 70 posts
  • Last active: Jul 22 2016 02:54 AM
  • Joined: 19 Sep 2010

Thanks again, works nicely now.



djvj
  • Members
  • 70 posts
  • Last active: Jul 22 2016 02:54 AM
  • Joined: 19 Sep 2010

Question, is RIni able to read/write a key's value in a file that has no sections defined? I have a cfg file that looks like a standard ini, just does not have any sections.