Jump to content

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

AhkIni - Fast Ini lib with linked comments support


  • Please log in to reply
7 replies to this topic
A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

AhkIni v0.3
 
Seeing topics on users asking how to store comments in Ini, I finally decided to release my work.
 
Ahkini is a Class to perform Ini reading and writing operations
It is created as a complete replacement of the default Ini commands

  • Much much faster than the default Ini operations [Depends on how you use it]
  • Support for reading/writing/deleting linked comments to keys and sections.
  • Same syntax as the default Ini commands.

 

Example Ini
https://gist.github....i-aryan/5947849

[section1]
;section1 comment
key1 = hithere
;keycomment
;line2
;line3
key2 = hithere
;keycomment2
 
[section2]
;section2 comment
key1 = hithere2
;keycomment2

The code

https://gist.github....i-aryan/5947853

SetWorkingDir,% A_scriptdir
 
Ini := new AhkIni("black2.ini")		;create new ini if nothing exists
ini.write("section1", "key1", "hithere", "keycomment`nline2`nline3")
ini.write("section1", "key2", "hithere", "keycomment2", "section1 comment")
ini.write("section2", "key1", "hithere2", "keycomment2", "section2 comment")
 
msgbox,% ini.read("section1", "key1", keycom, seccom) "`n`n" keycom "`n`n" seccom
 
ini.Save()

 
DOWNLOAD
Documentation (MUST SEE)


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


jNizM
  • Members
  • 928 posts
  • Last active: Jul 26 2017 09:19 AM
  • Joined: 01 Aug 2012
edit..
[AHK] 1.1.26.01 x64 Unicode | [WIN] 10 Pro (Version 1703)
My GitHub Profile | Donations are appreciated if I could help you

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

AhkIni.ahk
Line 22 /*SetWorkingDir,% A_scriptdir

Now, is that wrong.
Maybe, but it works fine here... confused.png
Maybe because of Ahk's version.
 
By the way, I have updated the script < Not taking chances >
 
 
Edit:--
 
So that was correct. cool.png


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


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

Updated the Documentation and example....
 
Please report if you find bugs wink.png


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


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

Updated to v0.3

  • Added missing support for reading out Sections and Keys list, as in the Iniread command.

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


Rijul Ahuja
  • Members
  • 763 posts
  • Last active: Nov 25 2013 10:16 AM
  • Joined: 14 Mar 2012

Avi, how did you test that it is faster (100x), as compared to the inbuilt Ini commands ? Can you show some benchmarks, perhaps using A_TickCount ?

EDIT : Is it because it uses FileAppend ?


Abandon the forum. The community has decided in a democratic vote to leave this website because of inactive and perverse administration.

Very few of the contributing members remain here.


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

Avi, how did you test that it is faster (100x), as compared to the inbuilt Ini commands ? Can you show some benchmarks, perhaps using A_TickCount ?
EDIT : Is it because it uses FileAppend ?

No, it's not like true 100x

All depends on the context where you use the commands.

 

If you are writing say some 10 different values to a INI one after another ,then my function will be faster but if you are writing repeating , iterative items to an Ini , the default ones will win because of cache-memory building.

In general use, I suppose my function will be a good - deal faster than the old stuffs.

 

I think I should remove the term 100x, gets a bit misleading 


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


Mapa4
  • Members
  • 10 posts
  • Last active: Aug 25 2017 06:42 PM
  • Joined: 11 Aug 2013

A small trick here : http://www.autohotke...f-ini/?p=636186