Jump to content

Ini


Recommended Posts

$sonw = @DesktopCommonDir &"\oniksodll.ini"
           $ones = IniWriteSection($sonw, "sectionnote", GUICtrlRead($onsetnamek))      
         $twos = IniWriteSection($sonw, "sectionnote2", GUICtrlRead($onsetplacek))  
           $threes = IniWriteSection($sonw, "sectionnote3", GUICtrlRead($date))     
          $fours = IniWriteSection($sonw, "sectionnote4", GUICtrlRead($time))   
           $fives = IniWriteSection($sonw, "sectionnote5", GUICtrlRead($notingonk))
             $item1 = GuiCtrlCreateListViewItem(IniReadSection($sonw, $ones), $mainonset)
                GUISetState(@SW_HIDE, $kongui)

i am pretty sure it has a lot of mistakes but INI is just not my best part of autoit so i need help....

(i am not familiar with INIs)

Edited by c4nm7
Link to comment
Share on other sites

so what's the problem?

ok as i mentioned im not too familiar with INIs so i will just explain what i want to do. i want the script to write the ini , and then as u can see read the sections and add them to the main gui as GuiCtrlCreateListViewItem under the GuiCtrlCreateListView...this does not works

whatever i instert in the first one the GuiCtrlCreateListViewItem is alwaye returned as 1

any suggestions?

Link to comment
Share on other sites

I believe that you would have to take the array returned by IniReadsection and convert each element to a ListViewItem.

Link to comment
Share on other sites

Also, your variable $ones is just the return code from the IniWriteSection() function, not a string of the section name.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Func _GetUser()
    If FileExists(@ScriptDir & '\names.ini') Then
        $User_index = _GUICtrlListViewGetItemCount($UserList)
        $ImportImage = IniReadSection($UserFile, "Image")
        $ImportName = IniReadSection($UserFile, "Users")
        $ImportPassword = IniReadSection($UserFile, "Password")
        For $a = 1 To $ImportImage[0][0]
            GUICtrlCreateListViewItem($ImportName[$a][1] & "|" & $ImportPassword[$a][1] & "|" & FileGetLongName($ImportImage[$a][1], 1), $UserList)
            GUICtrlSetImage(-1, $ImportImage[$a][1])
            If @error = 1 Then MsgBox(0x10, "Error", "There was an error importing user data.")
        Next
        _GUICtrlListViewSetColumnWidth($UserList, 2, $LVSCW_AUTOSIZE)
    Else
        MsgBox(0x10, "Request Error", "Could not import names. File doesn't exist.")
    EndIf
EndFunc   ;==>_GetUser

There is a excert from my program. Just change the control ID's.

Link to comment
Share on other sites

Func _GetUser()
    If FileExists(@ScriptDir & '\names.ini') Then
        $User_index = _GUICtrlListViewGetItemCount($UserList)
        $ImportImage = IniReadSection($UserFile, "Image")
        $ImportName = IniReadSection($UserFile, "Users")
        $ImportPassword = IniReadSection($UserFile, "Password")
        For $a = 1 To $ImportImage[0][0]
            GUICtrlCreateListViewItem($ImportName[$a][1] & "|" & $ImportPassword[$a][1] & "|" & FileGetLongName($ImportImage[$a][1], 1), $UserList)
            GUICtrlSetImage(-1, $ImportImage[$a][1])
            If @error = 1 Then MsgBox(0x10, "Error", "There was an error importing user data.")
        Next
        _GUICtrlListViewSetColumnWidth($UserList, 2, $LVSCW_AUTOSIZE)
    Else
        MsgBox(0x10, "Request Error", "Could not import names. File doesn't exist.")
    EndIf
EndFunc   ;==>_GetUser

There is a excert from my program. Just change the control ID's.

thanks a lot

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...