Tigerweld Posted June 23, 2008 Share Posted June 23, 2008 noob here, I'm stuck and don't know what to do next. I've looked at other examples but don't seem to understand the ok part. I'm trying to get input from the user and storing it as a string - can this be done? Anyways, here is my code. Thanks so much! CODE#include <GUIConstants.au3> GUICreate("Printer Drivers") GUICtrlCreateLabel("Select the printer model.", 10, 10) $4000P = GUICtrlCreateRadio ("4000 Printer", 10, 40, 80, 30) $4050P = GUICtrlCreateRadio ("4050 Printer", 10, 70, 80, 30) GUICtrlCreateButton("OK", 10, 120, 30) GUICtrlSetState ($4000P, $GUI_CHECKED) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $4000P And BitAND(GUICtrlRead($4000P), $GUI_CHECKED) = $GUI_CHECKED $Printer = ("c:\printerDrivers\4000\") Case $msg = $4050P And BitAND(GUICtrlRead($4050P), $GUI_CHECKED) = $GUI_CHECKED $Printer = ("c:\printerDrivers\4050\") EndSelect Wend Link to comment Share on other sites More sharing options...
Valuater Posted June 23, 2008 Share Posted June 23, 2008 #include <GUIConstants.au3> Global $Printer GUICreate("Printer Drivers") GUICtrlCreateLabel("Select the printer model.", 10, 10) $4000P = GUICtrlCreateRadio("4000 Printer", 10, 40, 80, 30) $4050P = GUICtrlCreateRadio("4050 Printer", 10, 70, 80, 30) $button = GUICtrlCreateButton("OK", 10, 120, 30) GUICtrlSetState($4000P, $GUI_CHECKED) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button If _IsChecked($4000P) Then $Printer = "c:\printerDrivers\4000\" If _IsChecked($4050P) Then $Printer = "c:\printerDrivers\4050\" MsgBox(0x0, "Test", " You chose " & $Printer, 4) EndSelect WEnd Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked 8) Link to comment Share on other sites More sharing options...
Tigerweld Posted June 23, 2008 Author Share Posted June 23, 2008 cool beans! Now how do I make it exit when I click ok? #include <GUIConstants.au3> Global $Printer GUICreate("Printer Drivers") GUICtrlCreateLabel("Select the printer model.", 10, 10) $4000P = GUICtrlCreateRadio("4000 Printer", 10, 40, 80, 30) $4050P = GUICtrlCreateRadio("4050 Printer", 10, 70, 80, 30) $button = GUICtrlCreateButton("OK", 10, 120, 30) GUICtrlSetState($4000P, $GUI_CHECKED) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button If _IsChecked($4000P) Then $Printer = "c:\printerDrivers\4000\" If _IsChecked($4050P) Then $Printer = "c:\printerDrivers\4050\" MsgBox(0x0, "Test", " You chose " & $Printer, 4) EndSelect WEnd Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked 8) Link to comment Share on other sites More sharing options...
Anonymouse Posted June 23, 2008 Share Posted June 23, 2008 cool beans! Now how do I make it exit when I click ok? #include <GUIConstants.au3> Global $Printer GUICreate("Printer Drivers") GUICtrlCreateLabel("Select the printer model.", 10, 10) $4000P = GUICtrlCreateRadio("4000 Printer", 10, 40, 80, 30) $4050P = GUICtrlCreateRadio("4050 Printer", 10, 70, 80, 30) $button = GUICtrlCreateButton("OK", 10, 120, 30) GUICtrlSetState($4000P, $GUI_CHECKED) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button If _IsChecked($4000P) Then $Printer = "c:\printerDrivers\4000\" If _IsChecked($4050P) Then $Printer = "c:\printerDrivers\4050\" MsgBox(0x0, "Test", " You chose " & $Printer, 4) Exit ; is this what you mean? EndSelect WEnd Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :) Link to comment Share on other sites More sharing options...
Tigerweld Posted June 23, 2008 Author Share Posted June 23, 2008 ok I just put an EXIT after the msg. I assume that is ok right? Link to comment Share on other sites More sharing options...
Tigerweld Posted June 25, 2008 Author Share Posted June 25, 2008 Hey if I place an EXIT it exits the script. I just want to close the form. What is the syntax for closing the for when I press OK? Link to comment Share on other sites More sharing options...
Anonymouse Posted June 25, 2008 Share Posted June 25, 2008 Hey if I place an EXIT it exits the script. I just want to close the form. What is the syntax for closing the for when I press OK? I believe you're looking for: GUIDelete ( [winhandle] ) children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :) Link to comment Share on other sites More sharing options...
Tigerweld Posted June 25, 2008 Author Share Posted June 25, 2008 Thanks, but how do I use that with an OK button? Link to comment Share on other sites More sharing options...
Anonymouse Posted June 27, 2008 Share Posted June 27, 2008 (edited) Thanks, but how do I use that with an OK button? GUIDelete deletes GUI. I'm on a friends lappy so I don't have autoit helpfile to back me up but I think GUICtrlDelete? It's usually the same thing for both... GUI = GUI Form & GUICtrl = GUI Control. So if you use GuiCtrlCreate on it, usually it should be GUICtrl[sufix] check the helpfile though, I may be wrong - Murphy knows it wouldn't be the first time. [edit] you might not want to Delete it though, it might be more effecient to DISABLE it. look up disable in the helpfile, too. I like that function [/edit] Edited June 27, 2008 by Anonymouse children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :) 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