ondrajka Posted December 23, 2008 Share Posted December 23, 2008 Cant seem to get it to save the $click var. After a button is pressed you get a yes or no was pressed msgbox. Click on ok and you get Error: varible used without being declared.#include <GUIConstantsEx.au3>Example()Func Example() Local $Button_1, $Button_2, $msg GUICreate("Yes No Box", 220, 75) Opt("GUICoordMode", 2) $Button_1 = GUICtrlCreateButton("Yes", 10, 30, 100) $Button_2 = GUICtrlCreateButton("No", 0, -1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 MsgBox(0, 'Testing', 'Yes was pressed') $click="Yes" ExitLoop Case $msg = $Button_2 MsgBox(0, 'Testing', 'No was pressed') $click="no" ExitLoop EndSelect WEnd GUIDelete()EndFunc MsgBox(0, 'After', $click) Link to comment Share on other sites More sharing options...
Developers Jos Posted December 23, 2008 Developers Share Posted December 23, 2008 #include <GUIConstantsEx.au3> Global $click Example() Func Example() Local $Button_1, $Button_2, $msg GUICreate("Yes No Box", 220, 75) Opt("GUICoordMode", 2) $Button_1 = GUICtrlCreateButton("Yes", 10, 30, 100) $Button_2 = GUICtrlCreateButton("No", 0, -1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 MsgBox(0, 'Testing', 'Yes was pressed') $click = "Yes" ExitLoop Case $msg = $Button_2 MsgBox(0, 'Testing', 'No was pressed') $click = "no" ExitLoop EndSelect WEnd GUIDelete() EndFunc ;==>Example MsgBox(0, 'After', $click) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ondrajka Posted December 23, 2008 Author Share Posted December 23, 2008 It works now ty. 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