RagnaroktA Posted September 26, 2006 Share Posted September 26, 2006 I'm trying to get the state of a checkbox (checked/unchecked) and it returns the same value for both. What am I doing wrong? I've tried: If BitAND(GUICtrlRead($cbxLaunchonstartup), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "Launchonstartup", "True") Else IniWrite($sRASINI, "User", "Launchonstartup", "False") Endif And: If GUICtrlRead($cbxLaunchonstartup) = $GUI_CHECKED Then IniWrite($sRASINI, "User", "Launchonstartup", "True") Else IniWrite($sRASINI, "User", "Launchonstartup", "False") Endif Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki Link to comment Share on other sites More sharing options...
GaryFrost Posted September 26, 2006 Share Posted September 26, 2006 Far as I can tell nope, it seems to work for me. expandcollapse popup#include <GUIConstants.au3> Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 1) $parent1 = GUICreate("Parent1") GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents") $cbxLaunchonstartup = GUICtrlCreateCheckbox("Test", 10, 10, 120, 20) GUICtrlSetOnEvent(-1, "_Test") GUISetState(@SW_SHOW) ; Just idle around While 1 Sleep(10) Wend ; END Func _Test() If BitAND(GUICtrlRead($cbxLaunchonstartup), $GUI_CHECKED) Then ConsoleWrite("True" & @LF) Else ConsoleWrite("False" & @LF) Endif EndFunc Func SpecialEvents() Select Case @GUI_CTRLID = $GUI_EVENT_CLOSE MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Exit Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Case @GUI_CTRLID = $GUI_EVENT_RESTORE MsgBox(0, "Window Restored", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) EndSelect EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
RagnaroktA Posted September 26, 2006 Author Share Posted September 26, 2006 (edited) It's still returning unchecked even when it's checked... I'm lost. sigh. expandcollapse popupFunc _WriteINI() ;IniWrite($sRASINI, "section", "key", "value") ;IniWrite(@ScriptDir & '\Settings.ini', "Export", "Program", "Text") ; IniRead($sRASINI, "section", "key", "default") If BitAND(GUICtrlRead($cbxMinimizeToTray), $GUI_CHECKED) Then Msgbox(0,"","Checked") ConsoleWrite("True" & @LF) Else Msgbox(0,"","Unchecked") ConsoleWrite("False" & @LF) Endif ; User If BitAND(GUICtrlRead($cbxLaunchonstartup), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "Launchonstartup", "True") Else IniWrite($sRASINI, "User", "Launchonstartup", "False") Endif If BitAND(GUICtrlRead($cbxCheckForUpdates), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "CheckForUpdatesonstart", "True") Else IniWrite($sRASINI, "User", "CheckForUpdatesonstart", "False") Endif If BitAND(GUICtrlRead($cbxSpecifyDefaultView), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "SpecifyDefaultView", "True") Else IniWrite($sRASINI, "User", "SpecifyDefaultView", "False") Endif If GUICtrlRead($cmbDefaultView) = "List View" Then IniWrite($sRASINI, "User", "SpecifyDefaultViewCombo", "List View") Else IniWrite($sRASINI, "User", "SpecifyDefaultViewCombo", "Domain View") Endif If BitAND(GUICtrlRead($cbxRefreshonstart), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "RefreshMachinesonstart", "True") Else IniWrite($sRASINI, "User", "RefreshMachinesonstart", "False") Endif If BitAND(GUICtrlRead($cbxRefreshFromList), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "RefreshMachinesFromList", "True") Else IniWrite($sRASINI, "User", "RefreshMachinesFromList", "False") Endif ; If GUICtrlRead($ibMachineListPath) <> "" Then ; IniWrite($sRASINI, "User", "RefreshMachinesList", $ibMachineListPath) ; Else ; IniWrite($sRASINI, "User", "RefreshMachinesList", $ibMachineListPath) ; Endif If BitAND(GUICtrlRead($cbxMinimizeToTray), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "MinimizeToTray", "True") Else IniWrite($sRASINI, "User", "MinimizeToTray", "False") Endif EndFunc; ==> _WriteINI Edited September 26, 2006 by RagnaroktA Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 26, 2006 Share Posted September 26, 2006 It's still returning unchecked even when it's checked... I'm lost. sigh. CODE Func _WriteINI() ;IniWrite($sRASINI, "section", "key", "value") ;IniWrite(@ScriptDir & '\Settings.ini', "Export", "Program", "Text") ; IniRead($sRASINI, "section", "key", "default") If BitAND(GUICtrlRead($cbxMinimizeToTray), $GUI_CHECKED) Then Msgbox(0,"","Checked") ConsoleWrite("True" & @LF) Else Msgbox(0,"","Unchecked") ConsoleWrite("False" & @LF) Endif ; User If BitAND(GUICtrlRead($cbxLaunchonstartup), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "Launchonstartup", "True") Else IniWrite($sRASINI, "User", "Launchonstartup", "False") Endif If BitAND(GUICtrlRead($cbxCheckForUpdates), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "CheckForUpdatesonstart", "True") Else IniWrite($sRASINI, "User", "CheckForUpdatesonstart", "False") Endif If BitAND(GUICtrlRead($cbxSpecifyDefaultView), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "SpecifyDefaultView", "True") Else IniWrite($sRASINI, "User", "SpecifyDefaultView", "False") Endif If GUICtrlRead($cmbDefaultView) = "List View" Then IniWrite($sRASINI, "User", "SpecifyDefaultViewCombo", "List View") Else IniWrite($sRASINI, "User", "SpecifyDefaultViewCombo", "Domain View") Endif If BitAND(GUICtrlRead($cbxRefreshonstart), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "RefreshMachinesonstart", "True") Else IniWrite($sRASINI, "User", "RefreshMachinesonstart", "False") Endif If BitAND(GUICtrlRead($cbxRefreshFromList), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "RefreshMachinesFromList", "True") Else IniWrite($sRASINI, "User", "RefreshMachinesFromList", "False") Endif ; If GUICtrlRead($ibMachineListPath) <> "" Then ; IniWrite($sRASINI, "User", "RefreshMachinesList", $ibMachineListPath) ; Else ; IniWrite($sRASINI, "User", "RefreshMachinesList", $ibMachineListPath) ; Endif If BitAND(GUICtrlRead($cbxMinimizeToTray), $GUI_CHECKED) Then IniWrite($sRASINI, "User", "MinimizeToTray", "True") Else IniWrite($sRASINI, "User", "MinimizeToTray", "False") Endif EndFunc; ==> _WriteINI You don't show where these checkboxes are created. Add a couple more debug ConsoleWrite's: ; Wherever you create the checkbox: $cbxMinimizeToTray = GuiCtrlCreateCheckbox("Minimize to tray", 100, 100) ConsoleWrite("$cbxMinimizeToTray = " & $cbxMinimizeToTray & @LF) ; Wherever you read the checkbox: ConsoleWrite("GuiCtrlRead(" & $cbxMinimizeToTray & ") = " & GUICtrlRead($cbxMinimizeToTray) & @LF) ConsoleWrite("$GUI_CHECKED = " & $GUI_CHECKED & @LF) If BitAND(GUICtrlRead($cbxMinimizeToTray), $GUI_CHECKED) Then Msgbox(0,"","Checked") ConsoleWrite("True" & @LF) Else Msgbox(0,"","Unchecked") ConsoleWrite("False" & @LF) Endif Might help track it down... 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 More sharing options...
GaryFrost Posted September 26, 2006 Share Posted September 26, 2006 When is the _WriteINI() function called? Hopefully not on AutoItExit.... SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
RagnaroktA Posted September 26, 2006 Author Share Posted September 26, 2006 When is the _WriteINI() function called?Hopefully not on AutoItExit....Nosir, sorry, I figured it out. I'd forgotten to call the function on the one variable I was trying to test. I'm an idiot. Thanks for your help! Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki Link to comment Share on other sites More sharing options...
GaryFrost Posted September 26, 2006 Share Posted September 26, 2006 Nosir, sorry, I figured it out. I'd forgotten to call the function on the one variable I was trying to test. I'm an idiot. Thanks for your help!http://www.autoitscript.com/fileman/users/gafrost/heresyoursign.jpg SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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