m4tius Posted May 13, 2010 Posted May 13, 2010 (edited) I want to save changed radios after click button. Those instructions doesnt work cuz in ini file there are "1" only - for every first radio of the group. Please help. There are some fragments of the script: GUIStartGroup() $Radio1 = GUICtrlCreateRadio("1", 389, 88, 33, 25) $Radio2 = GUICtrlCreateRadio("2", 429, 88, 33, 25) $Radio3 = GUICtrlCreateRadio("3", 469, 88, 33, 25) $Radio4 = GUICtrlCreateRadio("4", 509, 88, 33, 25) Case $msg = $Button2 $file = filesavedialog("Select Settings File", @ScriptDir, "Ini files (*.ini)", 2, "My Settings.ini") If not @Error Then If GUICtrlRead($Radio1) = $GUI_CHECKED Then IniWrite($file, "options", $Radio1, 1) ElseIf GUICtrlRead($Radio2) = $GUI_CHECKED Then IniWrite($file, "options", $Radio2, 1) ElseIf GUICtrlRead($Radio3) = $GUI_CHECKED Then IniWrite($file, "options", $Radio3, 1) ElseIf GUICtrlRead($Radio4) = $GUI_CHECKED Then IniWrite($file, "options", $Radio4, 1) EndIf EndIf Edited May 13, 2010 by m4tius
DW1 Posted May 13, 2010 Posted May 13, 2010 You were writing the value "1" for each radio control.IniWrite($file, "options", $Radio1, 1) is going to write "1"so isIniWrite($file, "options", $Radio2, 1). These will both write "1" since that is the "value" you supplied for all of them.#include <GuiConstantsEx.au3> GuiCreate('test', 600, 150) $Button2 = GUICtrlCreateButton("Button2", 0, 0, 100, 20) GUIStartGroup() $Radio1 = GUICtrlCreateRadio("1", 389, 88, 33, 25) $Radio2 = GUICtrlCreateRadio("2", 429, 88, 33, 25) $Radio3 = GUICtrlCreateRadio("3", 469, 88, 33, 25) $Radio4 = GUICtrlCreateRadio("4", 509, 88, 33, 25) GUISetState() While 1 Sleep(10) $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $Button2 $file = FileSaveDialog("Select Settings File", @ScriptDir, "Ini files (*.ini)", 2, "My Settings.ini") If Not @error Then If GUICtrlRead($Radio1) = $GUI_CHECKED Then IniWrite($file, "options", 'selected', 1) ElseIf GUICtrlRead($Radio2) = $GUI_CHECKED Then IniWrite($file, "options", 'selected', 2) ElseIf GUICtrlRead($Radio3) = $GUI_CHECKED Then IniWrite($file, "options", 'selected', 3) ElseIf GUICtrlRead($Radio4) = $GUI_CHECKED Then IniWrite($file, "options", 'selected', 4) Else IniWrite($file, "options", 'selected', 0) EndIf EndIf EndSwitch WEnd AutoIt3 Online Help
JohnOne Posted May 13, 2010 Posted May 13, 2010 Are you trying to save the state of a group of radio controls, where only one it selected in the group ? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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