ini files

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 01 January 2009   #1
ini files

I m back again lol

i start to work with ini files, and i was wondering how i could automatically add a new key string when i click on an button?

when i click on it, i get a string back and would like to add it into my ini file.

2nd question, how could i get back all of them into an array.

something like

Code:
for i = 1 to Ini_key.count do append StringArray (getINISetting iniExemple Exemple (i as string))
__________________
FX TD - Sony Pictures Imageworks
ww.aespid.com
 
Old 01 January 2009   #2
Run the code below and read the comments that I have made.

Code:
iniPath=(getDir #plugCfg)+"\\testIniFile.ini" setIniSetting iniPath "theSection1" "theKey1" "theValue1" setIniSetting iniPath "theSection1" "theKey2" "theValue2" setIniSetting iniPath "theSection1" "theKey3" "theValue3" setIniSetting iniPath "theSection2" "theKey1" "theValue1" setIniSetting iniPath "theSection2" "theKey2" "theValue2" setIniSetting iniPath "theSection2" "theKey3" "theValue3" setIniSetting iniPath "theSection3" "theKey1" "theValue1" setIniSetting iniPath "theSection3" "theKey2" "theValue2" setIniSetting iniPath "theSection3" "theKey3" "theValue3" sectionAr=getIniSetting iniPath --Returns an array of all the Sections keyAr=getIniSetting iniPath sectionAr[1] --Returns array of all the Keys getIniSetting iniPath sectionAr[1] keyAr[1] --Returns the value for the key
__________________
Paul Neale
http://paulneale.com
 
Old 01 January 2009   #3
and with PEN's code, doing the button thing is easy as well... in the button press event, you can use just the code for 'keyAr', and parse it (for example) as follows:
Code:
lastKey = keyAr[keyAr.count] "theKey3" lastCounter = (subString lastKey ((trimRight lastKey "0123456789").count + 1) -1) as integer 3 lastCounter += 1 4 setIniSetting iniPath "theSection1" ("theKey" + lastCounter as string) "theValueX" true
 
Old 01 January 2009   #4


thanks a lot guys
__________________
FX TD - Sony Pictures Imageworks
ww.aespid.com
 
Old 01 January 2009   #5
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:12 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.