chaos945 Posted November 16, 2004 Share Posted November 16, 2004 (edited) Bascially what this script will do is generate an INI file based on your preferences and then run a program with that config. If you run the program after the INI has been configured it is supposed to read the state of each button from the INI and allow you to modify them. The issue is its not reading my "12Hour" button correctly after reading the INI. For testing you'll have to run the script twice, the first run just leave the values alone. By default the "12Hour" button is in an active state = 1. The second time you run it you'll see that the button is in a closed state = 4....the 24Hour radio button works fine. expandcollapse popupGuiCreate("StartClock Configuration", 248, 148,(@DesktopWidth-224)/2, (@DesktopHeight-178)/2 , 0x04CF0000) Opt("GuiOnEventMode", 1) Opt("TrayIconHide", 1 ) ;Checks to see if StartClock is already running If WinExists ( "%_StartClock_%" ) Then WinKill ( "%_StartClock_%" ) EndIf AutoItWinSetTitle ( "%_StartClock_%" ) $Label_Options = GuiCtrlCreateLabel("Options:", 15, 10, 60, 20) ;HERE IS THE RADIO BUTTONS $Checkbox_12Hour = GuiCtrlCreateRadio("12 Hour Clock", 15, 30, 100, 20) $Checkbox_24Hour = GuiCtrlCreateRadio("24 Hour Clock", 15, 50, 90, 20) $Checkbox_ShowSeconds = GuiCtrlCreateCheckbox("Show Seconds", 15, 70, 90, 20) $Checkbox_ShowDate = GuiCtrlCreateCheckbox("Show Date", 15, 90, 70, 20) $Checkbox_Tray = GuiCtrlCreateCheckbox("Show Tray Icon", 140, 30, 100, 20) $Checkbox_Startup = GuiCtrlCreateCheckbox("Begin at Startup", 140, 50, 100, 20) $Checkbox_Hotkeys = GuiCtrlCreateCheckbox("Enable Hotkeys", 140, 70, 100, 20) $ok1 = GuiCtrlCreateButton("Save Changes", 20, 120, 90, 20) GUICtrlSetOnEvent(-1, "SavePressed") $cancel1 = GuiCtrlCreateButton("Cancel", 136, 120, 90, 20) GUICtrlSetOnEvent(-1, "CancelPressed") ;HERE IS WHAT IS CONTROLLING START VALUES If Not FileExists (@ScriptDir & "\StartClock.ini") Then GUICtrlSetState ( $Checkbox_12Hour, 1 ) Else GUICtrlSetState ( $Checkbox_12Hour, 1 ) GUICtrlSetState ( $Checkbox_ShowSeconds, IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ShowSeconds", "4" ) ) GUICtrlSetState ( $Checkbox_12Hour, IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "12HourClock", "1" ) ) GUICtrlSetState ( $Checkbox_24Hour, IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "24HourClock", "4" ) ) GUICtrlSetState ( $Checkbox_ShowDate, IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ShowDate", "4" ) ) GUICtrlSetState ( $Checkbox_Tray, IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "TrayIcon", "4" ) ) GUICtrlSetState ( $Checkbox_Startup, IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "BeginAtStartup", "4" ) ) GUICtrlSetState ( $Checkbox_Hotkeys, IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "EnableHotkeys", "1" ) ) EndIf GuiSetState() While 1 $GUI_EVENT_CLOSE = GuiGetMsg() Select Case $GUI_EVENT_CLOSE = -3 ExitLoop Case Else EndSelect WEnd Exit Func SavePressed() IniWrite ( "StartClock.ini", "Settings", "ShowSeconds", GUIRead($Checkbox_ShowSeconds) ) IniWrite ( "StartClock.ini", "Settings", "12HourClock", GUIRead($Checkbox_12Hour) ) IniWrite ( "StartClock.ini", "Settings", "24HourClock", GUIRead($Checkbox_24Hour) ) IniWrite ( "StartClock.ini", "Settings", "ShowDate", GUIRead($Checkbox_ShowDate) ) IniWrite ( "StartClock.ini", "Settings", "TrayIcon", GUIRead($Checkbox_Tray) ) IniWrite ( "StartClock.ini", "Settings", "BeginAtStartup", GUIRead($Checkbox_Startup) ) IniWrite ( "StartClock.ini", "Settings", "EnableHotkeys", GUIRead($Checkbox_Hotkeys) ) ;Run ( "StartClock.exe" ) Exit EndFunc Func CancelPressed() Exit EndFunc Edited November 16, 2004 by chaos945 Link to comment Share on other sites More sharing options...
Developers Jos Posted November 16, 2004 Developers Share Posted November 16, 2004 this way will work : If Not FileExists(@ScriptDir & "\StartClock.ini") Then GUICtrlSetState($Checkbox_12Hour, 1) Else GUICtrlSetState($Checkbox_ShowSeconds, IniRead(@ScriptDir & "\StartClock.ini", "Settings", "ShowSeconds", "4")) If IniRead(@ScriptDir & "\StartClock.ini", "Settings", "24HourClock", "4") = 4 Then GUICtrlSetState($Checkbox_12Hour, 1) Else GUICtrlSetState($Checkbox_24Hour, 1) EndIf SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
chaos945 Posted November 16, 2004 Author Share Posted November 16, 2004 Thanks. 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