Jump to content
Sign in to follow this  
Basti756

Find string and replace in ini file

Recommended Posts

Basti756

Hi,

I need help with finding and replacing a string. I wanna do the following:

- Read data from a combo

- search for that string in an ini file

- replace the string in the ini file with something (i.e. 5)

That's what the ini file looks like:

[name]
1=givenname7 lastname9
2=givenname5 lastname3
.
.
.

So let's say there's "givenname5 lastname3" written in the combo box. I want the script to find the string in the ini file and replace the value (and ONLY the value <_< ) with "5". How am I doing this? This can't be so difficult, but I'm running out of ideas...

Bastian

Share this post


Link to post
Share on other sites
Nahuel

GUIctrlRead() and IniWrite() <_<

Share this post


Link to post
Share on other sites
Achilles

Look at

$text = GuictrlRead($combo) <-- The data in the combo (called $combo) is stored (as $text)

$iniData = IniReadSection($location, 'name') <-- $iniData is now an array with all the data from the 'name' section

$temp = StringReplace('Hi how are you', 'are', 'aren't) <-- temp now equals 'Hi how aren't you'

All those can be found with loads more detail in the helpfile.

EDIT: Forgot IniWrite()

EDIT2: But it looks like Nahuel got that one covered

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×