Sign in to follow this  
Followers 0
Erik.

wire ini file question

7 posts in this topic

#1 ·  Posted (edited)

Hi,

I have a question.

I have an ini file whit many data into it and want to edit it...

This is an example of my ini file:

[Totaal]

1=63

[Members]

1=0001|Firstname|last|city|street|postzip|age|telephone

Now do i want to edit it whit a small script.

The script must open the ini file and put it all into an GUICtrlCreateListView

Then i need to select someone.

When i have selected someone the program must put all information into serveral inputboxes for this case 7 inputboxes because the number 0001 must be the same and can not be changed...

Then when you press on a button it will change the data of that person.

My problem is that i don't know hot to do it because the key is a count so it does not have any bandage whit other data

The numer 0001 is the cardnumber of that person

This is what i think but i want to know if it is treu

When you make a key like this:

[Members]

1=0001|Firstname|last|city|street|postzip|age|telephone

Then you write for the second time the same key but the 0001 to 0002 will it be changed does it overwrite it?

Can someone give me a little help whit it?

Gr Erik

Have a nice turn of the year and a great 2007!!!

PS could someone edit my topic name to the right name?

Edit ini file

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

I have a question.

I have an ini file whit many data into it and want to edit it...

This is an example of my ini file:

[Totaal]

1=63

[Members]

1=0001|Firstname|last|city|street|postzip|age|telephone

Now do i want to edit it whit a small script.

The script must open the ini file and put it all into an GUICtrlCreateListView

Then i need to select someone.

When i have selected someone the program must put all information into serveral inputboxes for this case 7 inputboxes because the number 0001 must be the same and can not be changed...

Then when you press on a button it will change the data of that person.

My problem is that i don't know hot to do it because the key is a count so it does not have any bandage whit other data

The numer 0001 is the cardnumber of that person

This is what i think but i want to know if it is treu

When you make a key like this:

[Members]

1=0001|Firstname|last|city|street|postzip|age|telephone

Then you write for the second time the same key but the 0001 to 0002 will it be changed does it overwrite it?

Can someone give me a little help whit it?

Gr Erik

Have a nice turn of the year and a great 2007!!!

PS could someone edit my topic name to the right name?

Edit ini file

Hi Erik

Here is the solution: Greetings and a good new year

Johannes

#include <GUIConstants.au3>
$iniPath='c:\a.ini'

GUICreate("listview items",420,250, 100,200,-1)

$listview = GUICtrlCreateListView ("0001|Firstname|last|city|street|postzip|age|telephone  ",10,10,400,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Value?",75,170,70,20)

$aMembers=IniReadSection ( $iniPath, 'members' )
For $i= 2 to $aMembers[0][0]
    GUICtrlCreateListViewItem($aMembers[$i][1],$listview)
Next
GUISetState()


Do
  $msg = GUIGetMsg ()
     
   Select
      Case $msg = $button
         MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
      Case $msg = $listview
         MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)
   EndSelect
Until $msg = $GUI_EVENT_CLOSE
Edited by jlorenz1

Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

hi i was trying to make something for me to test is this good?

how to read the first string of a key and the put it into a msgbox this is only the begin...

For $b = 1 to IniRead($members,"Totaal","1","")

$split = StringSplit(IniRead($members,"Members",$b,""),"|")

If $split[1] = GUICtrlRead($anumber) Then

it does not work for me but i will try to explain..

I need something that can open a ini file into a GUICtrlCreateListView from the section members.

To see how many members you have there is a section Totaal whit the number at it.

So to dread the inifile from member 0 to the last one i use this:

For $b = 1 to IniRead($members,"Totaal","1","")

The first array is the cardnumber for the first one 0001 for the second 0002 etc..

Then i need to edit all the data of that person but my problem is how to write it into the ini file at the same key? the ey is not the cardnumber!

The first array is tha cardnumber

Could someone help me whit that i think when i have that i can make it

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

hi i was trying to make something for me to test is this good?

how to read the first string of a key and the put it into a msgbox this is only the begin...

For $b = 1 to IniRead($members,"Totaal","1","")

$split = StringSplit(IniRead($members,"Members",$b,""),"|")

If $split[1] = GUICtrlRead($anumber) Then

it does not work for me but i will try to explain..

I need something that can open a ini file into a GUICtrlCreateListView from the section members.

To see how many members you have there is a section Totaal whit the number at it.

So to dread the inifile from member 0 to the last one i use this:

For $b = 1 to IniRead($members,"Totaal","1","")

The first array is the cardnumber for the first one 0001 for the second 0002 etc..

Then i need to edit all the data of that person but my problem is how to write it into the ini file at the same key? the ey is not the cardnumber!

The first array is tha cardnumber

Could someone help me whit that i think when i have that i can make it

Hi Eric,

it's a little bit difficult to understand you. Do you speak German? Why "Totaal" is so important for you? In my script the Func IniReadSection and $aMembers[0][0] estimate automatically the number of members.

if you want to make automatically a card number try this

For $i = 1 to 10
MsgBox(4160,'i', Stringformat("%04d",$i))
Next

In your example all Values in the ini-file are always strings not numbers - so you must convert them with Func Number:

For $b = 1 to Number(IniRead($members,"Totaal","1",""))

$split = StringSplit(IniRead($members,"Members",$b,""),"|")

If $split[1] = GUICtrlRead($anumber) Then


Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi,

I am Dutch :P

I know it is very dificult to understand because i can not explain so good what i have in my head..

example

Yesterday iwas in the shouwer thingking about the program and i knew what i need to do but when i was sitting at my computer i don't know it.

I know what i want but into the dutch it's very hard to explain because it is in my head and can not explain how to:P

What i need is a thing that i can full in a cardnumber that is the first string and then read the whole key and put that into a message box...

When i have that i think i can made it.

second thing:

When i have selected some one into the GUICtrlCreateListView all his or her data will be put into serveral input boxes how to do that?

so when i select this people:

0001|first|last|street|city|postzip|birth|phonenumber

then i have 7 inputboxes whit in each inputbox one string of data like this:

input1: first

input2:last

etc..

but when i select someone else then all his data must be put into the inputboxes..

i hope you can understand my explain now?

if you can you can add me @ msn that will talk little better?

EDIT:

This is how to read the whole ini file whit string one

For $b = 1 to Number(IniRead($members,"Totaal","1",""))

$split = StringSplit(IniRead($members,"Members",$b,""),"|")

MsgBox(0,"test",$split[1])

Next

But i want to know what key it is at that number but i don't know how...

EDIT2:

Srry i am trying and do not want to make a new post...

i have foundt his:

$var = IniReadSection($members, "members")

If @error Then

MsgBox(4096, "", "Error occurred, probably no INI file.")

Else

For $i = 1 To $var[0][0]

MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1])

Next

EndIf

Whit this i can read the key but now how to combinate those things?

Need a inptbox where i put the cardnumber into it and the program must look at what key it is how to do that?

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

Used this ini file:

[Totaal]
1 = 2
[Members]
1=0011|voornaam1|achternaam1|woonplaats1|poastcode1|geb.datum1|telefoonnummer1
2=0002|voornaam2|achternaam2|woonplaats2|poastcode2|geb.datum2|telefoonnummer2

This script will check the first field of each key till its found. the compare is alpanumeric so you need to type 0011 for a match:

$var = IniReadSection(@ScriptDir & "\myfile.ini", "Members")
If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
    Exit
EndIf
$Key = InputBox("Welke Key", "Wat is de key?")
$Found = 0
For $i = 1 To $var[0][0]
    $IniKeys = StringSplit($var[$i][1], "|")
    If $Key = $IniKeys[1] Then
        MsgBox(0, "Found", "Key found: " & $var[$i][1])
        $Found = 1
        ExitLoop
    EndIf
Next
If $Found = 0 Then
    MsgBox(0, "Not Found", "Key Not found in INI: " & $Key)
    Exit
EndIf

Hope this gets you started ....

:P


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Hi,

It works very fine lol i was close

Dankje werkt perfect...

Ga nu proberen om die andere dingen te maken..

Gr Erik


I little problem, hard to find and fix

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  
Followers 0