au3scr Posted February 7, 2008 Share Posted February 7, 2008 Hi How i can make myscript ask password before close? here is work that i have . I want that it only close if input value is "root" could anyone help me? #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("KMenu", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetBkColor(0x3A6EA5) $MenuItem1 = GUICtrlCreateMenu("Exit") $MenuItem11 = GUICtrlCreateMenuItem("exit", $MenuItem1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $MenuItem11 #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Input Length=4, Pwd Char=p If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Close","You must be root to close this window, Type your password here:","","p4","-1","-1","-1","-1") Select Case @Error = 0 ;OK - The string returned is valid Case @Error = 1 ;The Cancel button was pushed Case @Error = 3 ;The InputBox failed to open EndSelect #EndRegion --- CodeWizard generated code End --- exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
James Posted February 7, 2008 Share Posted February 7, 2008 OnAutoItExit() Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
au3scr Posted February 7, 2008 Author Share Posted February 7, 2008 How i add password request here? Sorry if its stupid question,but i just dont know it. #include <GUIConstants.au3> Opt("OnExitFunc", "endscript") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("KMenu", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetBkColor(0x3A6EA5) $MenuItem1 = GUICtrlCreateMenu("Exit") $MenuItem11 = GUICtrlCreateMenuItem("exit", $MenuItem1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $MenuItem11 endscript () EndSwitch WEnd Func endscript () Exit EndFunc Link to comment Share on other sites More sharing options...
ReaImDown Posted February 7, 2008 Share Posted February 7, 2008 (edited) Opt("OnExitFunc", "endscript") ;<----top of script Func endscript() $Password = InputBox("Enter Password", "Enter a password", "", "*") EndFunc ;==>endscript Edited February 7, 2008 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
au3scr Posted February 7, 2008 Author Share Posted February 7, 2008 thank you, it works now Link to comment Share on other sites More sharing options...
ReaImDown Posted February 7, 2008 Share Posted February 7, 2008 (edited) thank you, it works nownp, it was nothing, also, it can be found in the helpfilealso, it doesnt do anything with the password in the example I gave...it asks 4 the pass, then it just turns off lol, Edited February 7, 2008 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] 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