Chimaera Posted November 16, 2015 Posted November 16, 2015 I have a button on a small gui with 30 checkboxes that starts the final processThe checkboxes contain install switches like this[settings1] ms1= -a ms2= -d ms3= -e ms4= -erDoing this worksIf GUICtrlRead($MainCheckbox1) = $GUI_CHECKED Then $SwitchCheck = IniRead(@ScriptDir & "\settings.ini", "settings1", "ms1", "") $AddSwitches &= ' ' & $SwitchCheck EndIf If GUICtrlRead($MainCheckbox2) = $GUI_CHECKED Then $SwitchCheck = IniRead(@ScriptDir & "\settings.ini", "settings1", "ms2", "") $AddSwitches &= ' ' & $SwitchCheck EndIfBut i wanted to automate it so it just loops through and collects all the needed switchesSo i came up with this but its not showing the switchesFor $n = $MainCheckbox1 To $MainCheckbox30 GUICtrlRead($MainCheckbox + $n, $GUI_CHECKED) $SwitchCheck = IniRead(@ScriptDir & "\settings.ini", "settings1", "ms" + $n , "") $AddSwitches &= ' ' & $SwitchCheck NextAny pointers where i have gone wrong please? If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
mikell Posted November 16, 2015 Posted November 16, 2015 (edited) For $n = 1 To 30 If GUICtrlRead(Eval("MainCheckbox" & $n) = $GUI_CHECKED Then $SwitchCheck = IniRead(@ScriptDir & "\settings.ini", "settings1", "ms" & $n , "") $AddSwitches &= ' ' & $SwitchCheck EndIf NextBe careful with the meaning of variables Edited November 16, 2015 by mikell
water Posted November 16, 2015 Posted November 16, 2015 When creating the checkboxes assign the returned IDs to an array and then loop through this array. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Chimaera Posted November 17, 2015 Author Posted November 17, 2015 im holding water's suggestion in reserve atmo until i have worn out mikell'sOnwards another thought, i have set an IniWrite on every time a checkbox is selected so the gui remembers whats donebut it gives a perceptable lurch whilst it is doing the writing .Am i better to save them to the button at the end so it saves them all as one hit or do a little each time?i dont want the end to have a huge lurch either really... If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
water Posted November 17, 2015 Posted November 17, 2015 What do you mean by "perceptable lurch"? Half a second, a second? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Chimaera Posted November 17, 2015 Author Posted November 17, 2015 (edited) hard to explainyou click the checkbox and the lurch happens so it makes you want to click it again cos you think you didnt catch it.half a sec maybe before the tick appearsthe code to check it is like thisCase $MainCheckbox2 If GUICtrlRead($MainCheckbox2) = $GUI_CHECKED Then IniWrite(@ScriptDir & "\settings.ini", "gui", "g2", "1") _UpdateGui() GUICtrlSetData($CurrentSettings, "Current Settings = tn.bat" & $AddSwitches) Else IniWrite(@ScriptDir & "\settings.ini", "gui", "g2", "0") _UpdateGui() GUICtrlSetData($CurrentSettings, "Current Settings = tn.bat" & $AddSwitches) EndIf Func _UpdateGui() $AddSwitches = '' For $n = 1 To 30 If GUICtrlRead(Eval("MainCheckbox" & $n)) = $GUI_CHECKED Then $SwitchCheck = IniRead(@ScriptDir & "\settings.ini", "main", "ms" & $n, "") $AddSwitches &= ' ' & $SwitchCheck EndIf Next For $n = 1 To 10 If GUICtrlRead(Eval("SecondaryCheckbox" & $n)) = $GUI_CHECKED Then $SwitchCheck = IniRead(@ScriptDir & "\settings.ini", "secondary", "ss" & $n, "") $AddSwitches &= ' ' & $SwitchCheck EndIf Next ConsoleWrite(@ScriptDir & '\tn.bat' & $AddSwitches & @CRLF) Return $AddSwitches EndFunc ;==>_UpdateGuiThe way ive got it set it updates the Gui at every turn as things change Edited November 17, 2015 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
water Posted November 17, 2015 Posted November 17, 2015 You are doing a lot of processing (CtrlRead and IniRead plus the Eval statements) so I think half a second isn't too bad. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Chimaera Posted November 17, 2015 Author Posted November 17, 2015 ok thx for the info If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
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