RyanOlson Posted July 1, 2008 Share Posted July 1, 2008 (edited) This is very very annoying I have 3 check box's which correspond or should to regwrite statements when a button is pushed here is what that looks like Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $Button2 $varcb1 = GUICtrlRead($Checkbox1) $varcb2 = GUICtrlRead($Checkbox2) $varcb3 = GUICtrlRead($Checkbox3) If $varcb1 Then RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "PagingFiles", "REG_SZ", "C:\pagefile.sys 0 0") If $varcb2 Then RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "PagingFiles", "REG_SZ", "D:\pagefile.sys 0 0") If $varcb3 Then RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "PagingFiles", "REG_SZ", "E:\pagefile.sys 0 0") Ok it works but whateever check box is checked for some reason it keeps running E or cb3 I had it like this and it did the same thing If GUICtrlRead($Checkbox1) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "PagingFiles", "REG_SZ", "C:\pagefile.sys 0 0") that was how all 3 looked with the corresponding input please help oh with the variable to now i have to hit the button 2 times it seems to get it to go. Edited July 1, 2008 by RyanOlson Link to comment Share on other sites More sharing options...
Kiti Posted July 1, 2008 Share Posted July 1, 2008 (edited) opt("setoneventmode", 1) ;your GUI goes here Guictrlsetonevent($Button1, "Button1") func Button1() $msg = GuiGetMsg() Select Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED RegWrite(\"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\", \"PagingFiles\", \"REG_SZ\", \"C:\\pagefile.sys 0 0\") Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED RegWrite(\"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\", \"PagingFiles\", \"REG_SZ\", \"D:\\pagefile.sys 0 0\") Case $msg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED RegWrite(\"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\", \"PagingFiles\", \"REG_SZ\", \"E:\\pagefile.sys 0 0\") EndSelect WEnd EndFunc This should work fine Edit: This was the last edit, it's ok now Edited July 1, 2008 by Kiti Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 1, 2008 Share Posted July 1, 2008 (edited) GuiCtrlRead() on a checkbox returns the state, $GUI_CHECKED or $GUI_UNCHECKED, not true/false. To test the status, use this method: $varcb1 = GUICtrlRead($Checkbox1) If BitAnd($varcb1, $GUI_CHECKED) Then RegWrite(etc...) Edit: Modified to mask for result, because Checked/Unchecked is mixed in with Hidden/Visible, Enable/Disable, etc. P.S. To get just a True/False check of the control, you could use ControlCommand() with "IsChecked". Edited July 1, 2008 by PsaltyDS 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...
RyanOlson Posted July 1, 2008 Author Share Posted July 1, 2008 GuiCtrlRead() on a checkbox returns the state, $GUI_CHECKED or $GUI_UNCHECKED, not true/false. To test the status, use this method: $varcb1 = GUICtrlRead($Checkbox1) If BitAnd($varcb1, $GUI_CHECKED) Then RegWrite(etc...) Edit: Modified to mask for result, because Checked/Unchecked is mixed in with Hidden/Visible, Enable/Disable, etc. P.S. To get just a True/False check of the control, you could use ControlCommand() with "IsChecked". Salty your the man once again still new at this and from the example I did not see that I need to check if the return was checked but that works 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