Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 28th February 2008, 09:39   #1
dbach
Member
 
Join Date: Apr 2006
Location: Somewhere in Germany
Posts: 81
Howto change un-normal ini entries?

Hi together.

I have a problem with an .ini file. It looks like this:
[section]
entry = whatever.dll
entry = another.dll
entry = andsoon.dll

When I say "writeinistr" it replaces the first 'entry' with the new value. :|

How can I arrange this?
dbach is offline   Reply With Quote
Old 28th February 2008, 09:44   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
I doubt if this is a proper INI when all entries have the same name.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th February 2008, 09:48   #3
dbach
Member
 
Join Date: Apr 2006
Location: Somewhere in Germany
Posts: 81
Quote:
Originally posted by Red Wine
I doubt if this is a proper INI when all entries have the same name.
Thanks for your reply.
My problem is that the main product is already released and my installation is an addon for this product which requires to add this setting.
Any ideas?

Edit: I talked to one of the devs. He told me that they just read the "entry"'s in a array and uses them. Of course, the .ini isnt nicely designed but I still need to fix this problem. :|
dbach is offline   Reply With Quote
Old 28th February 2008, 09:54   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
You may use word functions header to find/replace the required value, however, I guess you understand that the INI is useless whatsoever.

http://nsis.sourceforge.net/Docs/AppendixE.html#E.3

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th February 2008, 10:18   #5
dbach
Member
 
Join Date: Apr 2006
Location: Somewhere in Germany
Posts: 81
Quote:
Originally posted by Red Wine
You may use word functions header to find/replace the required value, however, I guess you understand that the INI is useless whatsoever.

http://nsis.sourceforge.net/Docs/AppendixE.html#E.3
Well my problem is that I don't know what to find bcs the value doesn't exists yet and has to been included to the section so that it looks something like this:

[section]
entry = whatever.dll
entry = another.dll
entry = andsoon.dll
entry = myadded.dll

On unInstall I could use a WordReplace function but I have currently no idea how to
.) check if this entry was already written to the ini
.) add the entry without destroying another value

Thank you very much for your help so far, Red Wine!

Edit: The programm itself (for which the INI settings for) has no problems parsing the INI file and using the values. The only problem is myself adding more ununique values.
dbach is offline   Reply With Quote
Old 28th February 2008, 10:30   #6
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Then remove the old INI (no matter if the entry is written or not) and install a new one which includes myadded.dll.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th February 2008, 10:34   #7
dbach
Member
 
Join Date: Apr 2006
Location: Somewhere in Germany
Posts: 81
Quote:
Originally posted by Red Wine
Then remove the old INI (no matter if the entry is written or not) and install a new one which includes myadded.dll.
Also not possible bcs values could have been changed in this ini as well (its one big .ini file with settings for nearly all settings). :-|
dbach is offline   Reply With Quote
Old 28th February 2008, 10:43   #8
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Hmm! The INI has only one section, or several?

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th February 2008, 11:01   #9
dbach
Member
 
Join Date: Apr 2006
Location: Somewhere in Germany
Posts: 81
Quote:
Originally posted by Red Wine
Hmm! The INI has only one section, or several?
The Ini has serveral sections with unique names, but in the sections the names are not longer unique.
dbach is offline   Reply With Quote
Old 28th February 2008, 11:40   #10
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
What about this?
Attached Files
File Type: zip init.zip (624 Bytes, 61 views)

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th February 2008, 12:52   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Easiest solution is to loop through the existing file and compare each line with entry = myadded.dll$\r$\n. If that line isn't found, seek to the end then write the new line.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 28th February 2008, 12:55   #12
dbach
Member
 
Join Date: Apr 2006
Location: Somewhere in Germany
Posts: 81
Thanks for you replies. I will test the init.zip today (very special thanks!!) and report if its working for me. A dev told me that if he has to much time he will write a command-line util for me that handles this behaviour.

Thanks all!
dbach is offline   Reply With Quote
Old 28th February 2008, 13:11   #13
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
The example above works fine if the entry doesn't exist, though, it fails when the entry already exists.

The following example should work in every case,
Attached Files
File Type: zip initnew.zip (638 Bytes, 63 views)

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump