crystalburner Posted February 28, 2006 Share Posted February 28, 2006 $outlook = GUICtrlCreateRadio("Somebody works on this computer and it has Microsoft Outlook or Outlook Express e-Mail.", 5, 365) $exchange = GUICtrlCreateRadio("This computer is an unattended Server and has Microsoft Exchange Installed.", 5, 383) $nonms = GUICtrlCreateRadio("This computer is an unattended Server and has a non Microsoft e-Mail system installed.", 5, 401) I have 3 radio buttons in my gui and in the while 1 ... Wend loop i have $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE etc Wend Inside this While .. Wend loop I want to be able to see if radio button 3 has been selected but whatever code i try to put in the loop gets run forever and makes a mess. If someone chooses radio button nonms i just want a message to pop up once but if i put $test = GUICtrlRead ( $nonms ) returns 88 as the $test so if i put if $test = 88 msgbox "4,"","you chose nonms") i get an infinate loop of message boxes what am i doing wrong? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 28, 2006 Moderators Share Posted February 28, 2006 You could try something like this (I actually don't know if this is correct, but it seemed to work)#include <guiconstants.au3> $m = GUICreate('test') $nonms = GUICtrlCreateRadio('testradio', 10, 10) GUISetState() While 1 $msg = GUIGetMsg() If $msg = - 3 Then Exit If $msg = BitOR($nonms, $GUI_CHECKED) Then MsgBox(0, '', '') WEnd Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 28, 2006 Share Posted February 28, 2006 (edited) $outlook = GUICtrlCreateRadio("Somebody works on this computer and it has Microsoft Outlook or Outlook Express e-Mail.", 5, 365) $exchange = GUICtrlCreateRadio("This computer is an unattended Server and has Microsoft Exchange Installed.", 5, 383) $nonms = GUICtrlCreateRadio("This computer is an unattended Server and has a non Microsoft e-Mail system installed.", 5, 401) I have 3 radio buttons in my gui and in the while 1 ... Wend loop i have $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE etc Wend Inside this While .. Wend loop I want to be able to see if radio button 3 has been selected but whatever code i try to put in the loop gets run forever and makes a mess. If someone chooses radio button nonms i just want a message to pop up once but if i put $test = GUICtrlRead ( $nonms ) returns 88 as the $test so if i put if $test = 88 msgbox "4,"","you chose nonms") i get an infinate loop of message boxes what am i doing wrong? You could use $test as a flag to indicate you've already detected that button and not check it any more: #include <GUI_Constants.au3> $test = 0 While(1) If $test <> $GUI_CHECKED Then $test = GuiCtrlRead($nonms) ... etc. ... EndIf Wend Once you detect it is pushed (I may not have remembered the Macro correctly, but you get the idea), you won't test it again at all. Problem with that is radio buttons tend to get changed a couple times before the operator settles on the button they really wanted. That may drive you to use a seperate flag variable to hold the state of your test for the button. Hope that helped! Edit: The swiss cheese brain with the write-only memory never works, I got to a machine where I could look it up, and the value for a selected radio button is $GUI_CHECKED, not @BS_Pushed, and you can't use that constant without the GUI_Constants.au3 include file. Edited March 1, 2006 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...
crystalburner Posted February 28, 2006 Author Share Posted February 28, 2006 Bah ! You did it again I dont understand BITOR thats my problem... i'll read it.. but thanks really. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 1, 2006 Share Posted March 1, 2006 You could try something like this (I actually don't know if this is correct, but it seemed to work)#include <guiconstants.au3> $m = GUICreate('test') $nonms = GUICtrlCreateRadio('testradio', 10, 10) GUISetState() While 1 $msg = GUIGetMsg() If $msg = - 3 Then Exit If $msg = BitOR($nonms, $GUI_CHECKED) Then MsgBox(0, '', '') WEnd Cool! I didn't realize the messages returned by controls included the state as bits in the message. Usefull info... 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...
GaryFrost Posted March 1, 2006 Share Posted March 1, 2006 (edited) #include <guiconstants.au3> $m = GUICreate('test') $nonms = GUICtrlCreateRadio('test radio', 10, 10, 120) $nonms2 = GUICtrlCreateRadio('test radio 2', 10, 30, 120) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $nonms If BitAND(GUICtrlRead($nonms), $GUI_CHECKED) Then MsgBox(0, 'test', "radio") Case $msg = $nonms2 If BitAND(GUICtrlRead($nonms2), $GUI_CHECKED) Then MsgBox(0, 'test', "radio 2") EndSelect WEnd Edited March 1, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 1, 2006 Moderators Share Posted March 1, 2006 #include <guiconstants.au3> $m = GUICreate('test') $nonms = GUICtrlCreateRadio('test radio', 10, 10, 120) $nonms2 = GUICtrlCreateRadio('test radio 2', 10, 30, 120) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $nonms If BitAND(GUICtrlRead($nonms), $GUI_CHECKED) Then MsgBox(0, 'test', "radio") Case $msg = $nonms2 If BitAND(GUICtrlRead($nonms2), $GUI_CHECKED) Then MsgBox(0, 'test', "radio 2") EndSelect WEnd Ahh, I realized last night that I forgot GUICtrlRead() with the BitOr() when I was out and about, and forgot to post that here... Thanks Gary! Although I think it was one of your post anyway that I remembered that from Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
GaryFrost Posted March 1, 2006 Share Posted March 1, 2006 even better example of checking the state of the control #include <guiconstants.au3> $m = GUICreate('test') $nonms = GUICtrlCreateCheckbox('test checkbox', 10, 10, 120) $nonms2 = GUICtrlCreateCheckbox('test checkbox 2', 10, 30, 120) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $nonms If BitAND(GUICtrlRead($nonms), $GUI_CHECKED) Then MsgBox(0, 'test', "checkbox") Case $msg = $nonms2 If BitAND(GUICtrlRead($nonms2), $GUI_CHECKED) Then MsgBox(0, 'test', "checkbox 2") EndSelect WEnd SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted March 1, 2006 Share Posted March 1, 2006 Ahh, I realized last night that I forgot GUICtrlRead() with the BitOr() when I was out and about, and forgot to post that here... Thanks Gary! Although I think it was one of your post anyway that I remembered that from be careful which you use for this BitAnd/BitOr, notice which I used. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted March 1, 2006 Share Posted March 1, 2006 (edited) #include <GUIConstants.au3> ConsoleWrite(BitAND(BitOR($GUI_CHECKED,$GUI_DISABLE), $GUI_CHECKED) & @LF) ConsoleWrite(BitOR($GUI_DISABLE, $GUI_CHECKED) & @LF) ConsoleWrite(BitAND($GUI_DISABLE, $GUI_CHECKED) & @LF) Edited March 1, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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