sambalec Posted April 12, 2009 Share Posted April 12, 2009 (edited) Hello I have a probleme with my authentification function : CODE; A simple custom messagebox that uses the OnEvent mode #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $ExitID _Main() Func _Main() Local $YesID, $NoID GUICreate("SecureMyWeb - Admin", 210, 80) GUICtrlCreateLabel("Choisissez une option", 10, 10) $YesID = GUICtrlCreateButton("Paramètres", 10, 50, 70, 20) GUICtrlSetOnEvent($YesID, "OnYes") $ExitID = GUICtrlCreateButton("Fermer", 150, 50, 50, 20) GUICtrlSetOnEvent($ExitID, "OnExit") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() ; display the GUI While 1 Sleep(1000) WEnd EndFunc ;==>_Main ;--------------- Functions --------------- Func OnYes() MsgBox(0, "Choisissez une option", "Paramètres") EndFunc ;==>OnYes Func OnExit() If @GUI_CtrlId = $ExitID Then _authentification() Else _authentification() EndIf Exit EndFunc ;==>OnExit Func _authentification() ;AUTHENTIFICATION $text = InputBox("Authentification", "Enter your password :","","*") If @error = 1 Then MsgBox(4096, "Error", "You closed !") Exit Else If $text <> "multing" Then MsgBox(4096, "Errorr", "Wrong Password !") Exit Else EndIf EndIf EndFunc My problem is when i want to enter the password, error variable undefined $text.... Edited April 12, 2009 by sambalec Link to comment Share on other sites More sharing options...
BrettF Posted April 12, 2009 Share Posted April 12, 2009 Define it up the top of your script then... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
sambalec Posted April 12, 2009 Author Share Posted April 12, 2009 same problem :/ Link to comment Share on other sites More sharing options...
Dampe Posted April 12, 2009 Share Posted April 12, 2009 expandcollapse popup; A simple custom messagebox that uses the OnEvent mode #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $ExitID _Main() Func _Main() Local $YesID, $NoID GUICreate("SecureMyWeb - Admin", 210, 80) GUICtrlCreateLabel("Choisissez une option", 10, 10) $YesID = GUICtrlCreateButton("Paramètres", 10, 50, 70, 20) GUICtrlSetOnEvent($YesID, "OnYes") $ExitID = GUICtrlCreateButton("Fermer", 150, 50, 50, 20) GUICtrlSetOnEvent($ExitID, "OnExit") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() ; display the GUI While 1 Sleep(1000) WEnd EndFunc ;==>_Main ;--------------- Functions --------------- Func OnYes() MsgBox(0, "Choisissez une option", "Paramètres") EndFunc ;==>OnYes Func OnExit() If @GUI_CtrlId = $ExitID Then _authentification() Else _authentification() EndIf Exit EndFunc ;==>OnExit Func _authentification() Local $text ;AUTHENTIFICATION $text = InputBox("Authentification", "Enter your password :", "", "*") If @error = 1 Then MsgBox(4096, "Error", "You closed !") Exit Else If $text <> "multing" Then MsgBox(4096, "Errorr", "Wrong Password !") Exit Else EndIf EndIf EndFunc ;==>_authentification Just needed to declare $text inside your function 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