Skip to content
⌘ NSIS Forum Archive

Looping Text Search

4 posts

jmaerten#

Looping Text Search

I have searched all over and I couldn't find what I am looking for so any help is greatly appreciated.

I have an INI file with certain strings that have an integer value that increments:
eg.
string_1
string_2
... etc.

and I need to find what out what the maximum number is. And then I have to add a string using what the next number would be (ie. max num found +1). (Please note the strings are not necessarily in increasing order)

Thank you for your help,

Jamie
jmaerten#
There are a bunch of sections, and then there is a particular section where the modifcations need to take place.

Consider the example below of 'Widgets':

.... *bunch of stuff not applicable* ...

[Widgets]
bluewidget=_1_0_0
special_bluewidget={'bluewidget'}
widgets_42=bluewidget
yellowwidget=_2_3_0
special_yellowwidget={'yellowwidget'}
widgets_41=yellowwidget
... etc.

Where the 42, and 41 are, is what I am referring to. I need to find the max number. But these 'widgets' aren't in any particular order.

I hope that helps you help me.
jmaerten#
Fixed

I fixed that problem (by counting the number of times widgets_ was found )

Thanks for your help.