Fran Posted September 23, 2010 Share Posted September 23, 2010 Hi, See my script below. I want to disable the form whenever a change is detected with the radio buttons at the top. It seems to work (sort of), but I have to click the radio button a few times before the form is disabled. Can someone help me to fix this so it registers immediately when the button is pressed the first time? expandcollapse popup#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ------------------------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Francisca Carstens Script Function: Create .iso image files for RapidStudio software Installation - Update variables (labcodes and purls) in various files: AlbumMaker.ini, LabConfig.ini, User.ini, orderExplanationScreen.htm, createExplanationScreen.htm - Create Pre-Install screen Check for internet and ftp access Check for previous installation of AlbumMaker and prompts user to backup album files - Apply latest patch after installation to update a few files Order SDK, FTP Time-Out in FTPCore, delete thumbs.db and clear readonly attributes on all files in the installation directory as well as album directories #ce ------------------------------------------------------------------------------------------- #Region -> Includes #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ProgressConstants.au3> #include <GDIPlus.au3> #include <WinAPI.au3> #include <Array.au3> #include <file.au3> #include <GUIComboBox.au3> #include <GUIComboBoxEx.au3> #include <Process.au3> #include <_LargeFileCopy.au3> #include <EditConstants.au3> #include <GuiTab.au3> #include <Word.au3> #include <String.au3> #include <IE.au3> #EndRegion -> Includes #Region -> Options Opt("TrayAutoPause", 0) Opt("TrayIconHide", 0) Opt('MustDeclareVars', 0) #EndRegion -> Options #Region -> Declarations Global $configDir = @ScriptDir & "\config\", $imageDIR = @ScriptDir & "\images\", $webDIR = "\\web\webdir\rapidstudio.info\fran", $fileLabcodes = $webDIR & "\labcodes.txt", $fileSubLabcodes = $webDIR & "\sublabcodes.txt" $oIE = _IECreate("http://www.rapidstudio.info/fran/labcodelist.php", 0, 0, 1) _IEQuit($oIE) Local $y = 860, $z = 600, $g = 15 ;y:gui width, g:margin, z:gui height Local $b = $g, $c = $y - ($g * 2) ;b:left position of main box; c:width of main box Local $l = $b + $g, $w = $c - ($g * 2) ;l:left position of cat boxes; $w:width of cat boxes Local $p = 90, $q = 30, $pS = 50, $qS = 20 ;p:button width, q:buttn height, pS:small button width, qS: small button height Local $d = $z - $q - ($g * 3) ;d:height of main box Local $n = $y - $g - $p, $o = $z - $g - $q, $r = $n - $g - $p ;n:button left, o:button top, r:button2 left Local $tL = $l + $g, $tT = $g + 45, $tW = 100 ;tL:textlabels left, $tT: 1st textlabel top, $tW:textlabels width Local $font = "Courier New" #EndRegion -> Declarations #Region -> GUI Items $gui = GUICreate("Create ISO image", $y, $z + 30, -1, -1) $radio1 = GUICtrlCreateRadio("Affiliate", ($g * 2), $g, 150, 30) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetFont(-1, 18) $radio2 = GUICtrlCreateRadio("Sub-Affiliate", ($g * 3) + 150, $g, 150, 30) GUICtrlSetFont(-1, 18) $but1 = GUICtrlCreateButton("Go", $tL + ($g * 3) + 300, $g, $p, $q) $box = GUICtrlCreateGroup("Setup info", $b, $tT, $c, $z - ($g * 6)) #Region -> ComboBox lAB CODE $labelCODE = GUICtrlCreateLabel("Lab Code", $tL, $tT + 30, $tW, 20) GUICtrlSetFont(-1, 0, 400, 0) Global $hComboCODE = GUICtrlCreateCombo("...", $tL + $tW + $g, $tT + 30, 200) GUICtrlSetFont(-1, 0, 400, 0, $font, 5) _GUICtrlComboBox_SetExtendedUI(-1, True) #EndRegion -> ComboBox lAB CODE #Region -> ComboBox VERSION Global $hComboVERSION = GUICtrlCreateCombo("...", $tL + $tW + $g, $tT + 30, 200) GUICtrlSetFont(-1, 10, 400, 0, $font, 5) _GUICtrlComboBox_SetExtendedUI(-1, True) #EndRegion -> ComboBox VERSION #EndRegion -> GUI Items _Main() Func _Main() GUISetState() $var = 1 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE If MsgBox(8196, "Cancel", "Are you sure you want to cancel this operation?") = 6 Then Exit Case $but1 $var = 0 GUICtrlSetState($hComboCODE, $GUI_ENABLE) GUICtrlSetState($labelCODE, $GUI_ENABLE) GUICtrlSetData($hComboCODE, "") If BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED Then Dim $file = $fileLabcodes GUICtrlSetData($hComboCODE, "Choose Lab Code") $code = "Lab Code" ElseIf BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED Then Dim $file = $fileSubLabcodes GUICtrlSetData($hComboCODE, "Choose Sub-Lab Code") $code = "Sub-Lab Code" EndIf Dim $aRecords If Not _FileReadToArray($file, $aRecords) Then MsgBox(4096 + 16, "Error", " Error reading labcodes to Array error:" & @error) Exit EndIf $sFileList = _ArrayToString($aRecords, "|", 1) If @error Then MsgBox(0, "Error", "Error converting array to string.") Exit EndIf GUICtrlSetData($hComboCODE, $sFileList, "Choose " & $code) GUICtrlSetState($hComboCODE, $GUI_FOCUS) EndSwitch If $var = 0 Then If GUIGetMsg() = $radio1 Then GUICtrlSetState($hComboCODE, $GUI_DISABLE) GUICtrlSetState($labelCODE, $GUI_DISABLE) $var = 1 EndIf EndIf WEnd EndFunc ;==>_Main #Region -> Functions #EndRegion -> Functions Link to comment Share on other sites More sharing options...
Fran Posted September 23, 2010 Author Share Posted September 23, 2010 I think I've figured it out... I've just added the following script (and removed the "if guigetmsg()..." part just before the WEnd) [autoit] Case $radio1, $radio2 GUICtrlSetState($hComboCODE, $GUI_DISABLE) GUICtrlSetState($labelCODE, $GUI_DISABLE) [\autoit] 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