2013-07-26 111 views
0

我做了這個功能:寫入和讀取組合中的AutoIt

Func ReadStats() 
$Read1 = IniRead("C:\Config.ini", "Checkbox", "Check1", "1") 
$Read2 = IniRead("C:\Config.ini", "Checkbox", "Check2", "1") 
$Read3 = IniRead("C:\Config.ini", "Combo", "Comb1", StringSplit("-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M", "|")) 
GUICtrlSetState($chosen, IniRead("C:\Config.ini", "Combo", "Comb1", StringSplit("-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M", "|"))) 
If $Read1 = Int(1) = 1 Then 
    GUICtrlSetState($Checkbox1, $GUI_CHECKED) 
Else 
    GUICtrlSetState($Checkbox1, $GUI_UNCHECKED) 
EndIf 
If $Read2 = Int(1) = 1 Then 
    GUICtrlSetState($Checkbox2, $GUI_CHECKED) 
Else 
    GUICtrlSetState($Checkbox2, $GUI_UNCHECKED) 
EndIf 
EndFunc 

1.如何得到這個工作

$Read3 = IniRead("C:\Config.ini", "Combo", "Comb1", StringSplit("-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M", "|")) 
GUICtrlSetState($chosen, IniRead("C:\Config.ini", "Combo", "Comb1", StringSplit("-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M", "|"))) 

2.我怎樣才能得到它運行在啓動功能一次?如果你想知道,我用這個代碼寫信息:

 Case $GUI_EVENT_CLOSE 
     IniWrite("C:\Config.ini", "Checkbox", "Check1", GUICtrlRead($Checkbox1)) 
     IniWrite("C:\Config.ini", "Checkbox", "Check2", GUICtrlRead($Checkbox2)) 
     IniWrite("C:\Config.ini", "Combo", "Comb1", $chosen) 
     Exit 

的$ COMBO1是這樣創建的:

$Combo1 = GUICtrlCreateCombo("-Xmx512M", 24, 872, 161, 25, $CBS_DROPDOWNLIST) 
GUICtrlSetData(-1, "-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M") 

回答

0
GUICtrlSetData($Combo1, IniRead("C:\Config.ini", "Combo", "Comb1", -Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M")) 

像這樣的事情?
克拉姆

+0

感謝@Cramaboule。它解決了寫入問題。我也有它在啓動時閱讀,所以現在我不需要每次都配置它。 – EpicKnarvik97