dufran3 Posted August 8, 2007 Share Posted August 8, 2007 I have a gui with several input boxes. I have a If statement making the first 2 inputs required. How do I make is so that if someone types something in the input control $CollectEpisodeNumber, then the script will not continue unless something is also in the input control, $CollectEpisodeSeason. I will post the code I have. expandcollapse popup;Create GUI $Main = GUICreate('Newzbin Auto Downloader', 300, 150) Opt("GUICoordMode",1) $CollectName = GUICtrlCreateInput('',100,10,150) $NameLabel = GUICtrlCreateLabel('Name of Item',15,13) $CollectCategory = GUICtrlCreateCombo('',100,35,60,$CBS_UPPERCASE,$CBS_DROPDOWNLIST) GUICtrlSetData(-1,"Unknown|Anime|Apps|Books|Consoles|Emulation|Games|Misc|Movies|Music|PDA|TV") $CategoryLabel = GUICtrlCreateLabel('Category',15,38) $CollectEpisodeSeason = GUICtrlCreateInput('',100,60,50) $EpisodeSeasonLabel = GUICtrlCreateLabel('Episode Season',15,63) $CollectEpisodeNumber = GUICtrlCreateInput('',100,85,50) $EpisodeLabelLabel = GUICtrlCreateLabel('Episode Number',15,88) $CollectMaxItems = GUICtrlCreateInput('',100,110,50) $MaxItemsLabel = GUICtrlCreateLabel('Max # of Items',15,112) GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button_1 GLOBAL $Name = GUICtrlRead($CollectName) GLOBAL $Category = GUICtrlRead($CollectCategory) GLOBAL $MaxItems = GUICtrlRead($CollectMaxItems) GLOBAL $EpisodeSeason = GUICtrlRead($CollectEpisodeSeason) GLOBAL $EpisodeNumber = GUICtrlRead($CollectEpisodeNumber) If $Name == '' OR $Category =='' Then MsgBox(0,'Name','Both name and category are required!') Else WinSetState('Newzbin Auto Downloader','',@SW_HIDE) ExitLoop EndIf Case $msg = $Button_2 Exit EndSelect Wend Link to comment Share on other sites More sharing options...
Gif Posted August 8, 2007 Share Posted August 8, 2007 try:expandcollapse popup#include <GuiConstants.au3> Opt("GUICoordMode", 1) $Main = GUICreate('Newzbin Auto Downloader', 300, 150) $CollectName = GUICtrlCreateInput('', 100, 10, 150) $NameLabel = GUICtrlCreateLabel('Name of Item', 15, 13) $CollectCategory = GUICtrlCreateCombo('', 100, 35, 60, $CBS_UPPERCASE, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Unknown|Anime|Apps|Books|Consoles|Emulation|Games|Misc|Movies|Music|PDA|TV") $CategoryLabel = GUICtrlCreateLabel('Category', 15, 38) $CollectEpisodeSeason = GUICtrlCreateInput('', 100, 60, 50) $EpisodeSeasonLabel = GUICtrlCreateLabel('Episode Season', 15, 63) $CollectEpisodeNumber = GUICtrlCreateInput('', 100, 85, 50) $EpisodeLabelLabel = GUICtrlCreateLabel('Episode Number', 15, 88) $CollectMaxItems = GUICtrlCreateInput('', 100, 110, 50) $MaxItemsLabel = GUICtrlCreateLabel('Max # of Items', 15, 112) GUISetState() $rd = GUICtrlRead($CollectEpisodeNumber) While 1 If $rd <> GUICtrlRead($CollectEpisodeNumber) Then If GUICtrlRead($CollectEpisodeSeason) == '' Then GUICtrlSetData($CollectEpisodeNumber, $rd) EndIf EndIf $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button_1 Global $Name = GUICtrlRead($CollectName) Global $Category = GUICtrlRead($CollectCategory) Global $MaxItems = GUICtrlRead($CollectMaxItems) Global $EpisodeSeason = GUICtrlRead($CollectEpisodeSeason) Global $EpisodeNumber = GUICtrlRead($CollectEpisodeNumber) If $Name == '' Or $Category == '' Then MsgBox(0, 'Name', 'Both name and category are required!') Else WinSetState('Newzbin Auto Downloader', '', @SW_HIDE) ExitLoop EndIf Case $msg = $Button_2 Exit EndSelect WEnd Link to comment Share on other sites More sharing options...
dufran3 Posted August 8, 2007 Author Share Posted August 8, 2007 Appears to work like a charm! 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