LokErik Posted March 18, 2008 Share Posted March 18, 2008 Hi, I have a little problem with a thing. I hope you can help me out I am trying to read a INI file, In the [section] i whant to program to seek the last Key= And the Keys are in Number Order. Can it be done or may I whrite it on a other way? /lokErik The first error is one step closer to the perfect program. Link to comment Share on other sites More sharing options...
Squirrely1 Posted March 18, 2008 Share Posted March 18, 2008 $arr = IniReadSection("squirrels.ini", "MySection") $x = $arr[0][0]; last key name = $arr[$x][0] Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
LokErik Posted March 18, 2008 Author Share Posted March 18, 2008 So now i am gonna enter a new key and the number needed to be after the last one. like this. CODEFunc NyttOrd() #include <GUIConstants.au3> GUISetState(@SW_HIDE, $Form1) $Form2 = GUICreate("Nytt Ord", 150, 100, 230, 140) $SvenskNy = GUICtrlCreateInput("", 30, 15, 100, 20) $TyskNy = GUICtrlCreateInput("", 30, 40, 100, 20) $Button2 = GUICtrlCreateButton("Spara Ord", 38, 70, 85, 25) GUICtrlCreateLabel("Sv", 5, 18, 14, 20) GUICtrlCreateLabel("Ty", 5, 43, 14, 20) GUISetState(@SW_SHOW, $Form2) While 2 $INIsv = GUICtrlRead($SvenskNy) $INIty = GUICtrlRead($TyskNy) $msg = GUIGetMsg() Switch $msg Case $Button2 ;Here is the help needed to read last key >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> IniWrite("Tyska.ini", "Ord", ;The new key, $INIsv) IniWrite("Tyska.ini", "TyOrd", ;The new key, $INIty) MsgBox(0, "Ord Tillagt", "Ord Tillagda." & @CRLF & @CRLF & $INIsv & " = " & $INIty & ".", 5) Case $GUI_EVENT_CLOSE GUISetState(@SW_SHOW, $Form1) GUIDelete($Form2) ExitLoop EndSwitch WEnd EndFunc And this is how the ini looks like. CODE[Ord] 1=genom 2=men 3=snart 4=nästan 5=nu 6=inte 7=ibland 8=tyvärr 9=alltid 10=också [TyOrd] 1=durch 2=aber 3=bald 4=fast 5=jetzt 6=nicht 7=manchmal 8=leider 9=immer 10=auch is it possible The first error is one step closer to the perfect program. Link to comment Share on other sites More sharing options...
LokErik Posted March 19, 2008 Author Share Posted March 19, 2008 Thanks Squirrely1, i found out how to do. The first error is one step closer to the perfect program. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now