Jos07 Posted May 27, 2008 Share Posted May 27, 2008 (edited) hi forum members, i want to set a hot key to terminate my script. have done it... but the problem is how can i set a password for terminating the script ? i have setted ctrl+A+Esc which terminates the script. but i want that it should ask for a password in order to terminate the script. for example if i will press Ctrl+A+Esc then it should prompt for password. i want like this : ; Please Enter Your Password Below in order to terminate the program. _____________________________ / My Password Here / ~~~~~~~~~~~~~~~~~~~~~~~~ ; it was just a example like i want... so... anyone knows how to do it ? thanx! Edited May 27, 2008 by Jos07 Always Keep Your Sig Small... Like me :D Link to comment Share on other sites More sharing options...
icadea Posted May 27, 2008 Share Posted May 27, 2008 a few Example HotKeySet("{F5}", "terminate") . . . script goes here . . . Func terminate() $passwd = InputBox("title", "Enter password.", "", "*", 180, 50) If $passwd = "test" Then Exit Else EndIf Endfunc hope it helps Link to comment Share on other sites More sharing options...
d4rk Posted May 27, 2008 Share Posted May 27, 2008 (edited) ok, it's simple to ask for password, this will show you func _exit() $pass=inputbox("Password","",100,100);don't know if this creat the input box, i write this from my memory if $pass="pass" then exit else msgbox(64,"","Wrong pass") endfunc Edited May 27, 2008 by d4rk [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
Jos07 Posted May 27, 2008 Author Share Posted May 27, 2008 thanks! but i could not understand it ... will you please explain it with some description ? thanx! Always Keep Your Sig Small... Like me :D Link to comment Share on other sites More sharing options...
d4rk Posted May 27, 2008 Share Posted May 27, 2008 func _exit() $pass=inputbox("Password","Enter password","","*",100,100);Show a input box to ask for password if $pass="pass" then; if the password = "pass" , you can change to anything exit;then exit else msgbox(64,"","Wrong pass");pass is wrong, keep working ... endfunc [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
Jos07 Posted May 27, 2008 Author Share Posted May 27, 2008 i want to know that where to put this code in my script ? if my script is as follow... ; Opt(\"WinTitleMatchMode\", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase $var = ControlGetText(\" - Windows Internet Explorer\", \"\", \"Edit1\") $oHTTP = ObjCreate(\"winhttp.winhttprequest.5.1\") $oHTTP.Open(\"GET\",$var) ; navigate to page where image is displayed $oHTTP.Send() $HTMLSource = $oHTTP.Responsetext $_Arrayline = StringSplit($HTMLSource, @LF) ; this is the Array $_Arrayline we put the page source to array hire for $i = 1 to $_Arrayline[0] If StringInStr($_Arrayline[$i],\'porn\') Then MsgBox(0,\'\',$_Arrayline[$i]) ; search source for porn word Next ; thanx! Always Keep Your Sig Small... Like me :D Link to comment Share on other sites More sharing options...
d4rk Posted May 27, 2008 Share Posted May 27, 2008 the _exit func is stand alone, it can be at the begining or the end of the script ; Opt(\"WinTitleMatchMode\", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase $var = ControlGetText(\" - Windows Internet Explorer\", \"\", \"Edit1\") $oHTTP = ObjCreate(\"winhttp.winhttprequest.5.1\") $oHTTP.Open(\"GET\",$var) ; navigate to page where image is displayed $oHTTP.Send() $HTMLSource = $oHTTP.Responsetext $_Arrayline = StringSplit($HTMLSource, @LF) ; this is the Array $_Arrayline we put the page source to array hire for $i = 1 to $_Arrayline[0] If StringInStr($_Arrayline[$i],\'porn\') Then MsgBox(0,\'\',$_Arrayline[$i]) ; search source for porn word Next ; HotKeySet("{ESC}", "_exit") func _exit() $pass=inputbox("Password","Enter password","","*",100,100);Show a input box to ask for password if $pass="pass" then; if the password = "pass" , you can change to anything exit;then exit else msgbox(64,"","Wrong pass");pass is wrong, keep working ... endfunc [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
rambo3889 Posted May 27, 2008 Share Posted May 27, 2008 D4rk you are missing an endif in the _exit function. My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight! Link to comment Share on other sites More sharing options...
Jos07 Posted May 27, 2008 Author Share Posted May 27, 2008 oh, so then why you just dont correct it or put another wih your idea ? Always Keep Your Sig Small... Like me :D Link to comment Share on other sites More sharing options...
monoceres Posted May 27, 2008 Share Posted May 27, 2008 oh, so then why you just dont correct it or put another wih your idea ?Because he assumed you could fix one of the simpliest thing in the language yourself? Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
rambo3889 Posted May 27, 2008 Share Posted May 27, 2008 or maybe because i was running out of time. i posted 2:47, i meet at work 3:00. i usualy drive from home at 2:45, so i was actually late, because i was reading this topic. But for your enjoyment here is the corected one ( Jos07 ) func _exit() $pass=inputbox("Password","Enter password","","*",100,100);Show a input box to ask for password if $pass="pass" then; if the password = "pass" , you can change to anything exit;then exit else msgbox(64,"","Wrong pass");pass is wrong, keep working ... endif endfunc My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight! Link to comment Share on other sites More sharing options...
Jos07 Posted May 27, 2008 Author Share Posted May 27, 2008 know where was error but i was acting like this because i want to know more solutions. i thought you will give another solution... lols i just want to know all available functions related to this. Always Keep Your Sig Small... Like me :D Link to comment Share on other sites More sharing options...
rambo3889 Posted May 27, 2008 Share Posted May 27, 2008 Okay here is another way which allows the user to mistype 3 times Func _exit() $counts = 3 $tryed = 1 $access = "Denied" $ourverysecretpass = "Dav" $x = InputBox("Password", "Enter your password(Case sensitive)", "", "*") If $x == $ourverysecretpass Then $access = "Granted" Else Do $x_second = InputBox("Password", "Wrong password please enter your password(Case sensitive)", "", "*") If $ourverysecretpass = $x_second Then $access = "Granted" ExitLoop EndIf $tryed += 1 Until $tryed = $counts EndIf If $access = "Granted" Then Exit EndFunc ;==>_exit My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight! Link to comment Share on other sites More sharing options...
Jos07 Posted May 27, 2008 Author Share Posted May 27, 2008 if the password is wrong for three times then it closes the input box without any message box. how can i add message box if password is wrong or right. thanx! Always Keep Your Sig Small... Like me :D Link to comment Share on other sites More sharing options...
Jos07 Posted May 27, 2008 Author Share Posted May 27, 2008 ok i have done it but a little bug in it HotKeySet(\"{f}{Esc}\", \"_exit\") Func _exit() $counts = 3 $tryed = 1 $access = \"Denied\" $ourverysecretpass = \"Dav\" $x = InputBox(\"Password\", \"Enter your password(Case sensitive)\", \"\", \"*\") If $x == $ourverysecretpass Then $access = \"Granted\" MsgBox(0, \"Accepted\", \"Stopped\") Else Do $x_second = InputBox(\"Password2\", \"Wrong password please enter your password(Case sensitive)\", \"\", \"*\") If $ourverysecretpass = $x_second Then $access = \"Granted\" MsgBox(0, \"Accepted2\", \"Stopped2\") ExitLoop EndIf $tryed += 1 Until $tryed = $counts EndIf If $access = \"Granted\" Then Else MsgBox(0,\"Password failled\", \"Will continue running\") endif Else EndFunc ;==>_exit this also closes the script at the end of last message but i dont want to close it if password is wrong. anyone knows what i am doing wrong ? it closes at the third time if password is wrong. but it should not close at the last message if password is wrong. thanx! Always Keep Your Sig Small... Like me :D Link to comment Share on other sites More sharing options...
rambo3889 Posted May 27, 2008 Share Posted May 27, 2008 something like this: HotKeySet("{Esc}","_exit") while 1 ;Do what ever you want to. Sleep(100);Don't max out the cpuf WEnd Func _exit() ConsoleWrite("" & @CRLF) $counts = 3 $tryed = 1 $access = "Denied" $ourverysecretpass = "Dav" $x = InputBox( "Password", "Enter your password(Case sensitive)", "", "*") If $x == $ourverysecretpass Then $access = "Granted" MsgBox(0, "Accepted", "Stopped") Else Do $x_second = InputBox( "Password2", "Wrong password please enter your password(Case sensitive)", "", "*") If $ourverysecretpass = $x_second Then $access = "Granted" MsgBox(0, "Accepted2 ", "Stopped2") ExitLoop EndIf $tryed += 1 Until $tryed = $counts EndIf If $access = "Granted" Then Exit Else MsgBox(0, "Password failled ", "Will continue running ") Return endif EndFunc ;==>_exit My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight! Link to comment Share on other sites More sharing options...
Jos07 Posted May 28, 2008 Author Share Posted May 28, 2008 Thanx! it is working fine now! Always Keep Your Sig Small... Like me :D Link to comment Share on other sites More sharing options...
system24 Posted May 28, 2008 Share Posted May 28, 2008 Add an infinite loop into your code. HotKeySet(\"{f}{Esc}\", \"_exit\") ;The infinite loop While 1 WEnd Func _exit() $counts = 3 $tryed = 1 $access = \"Denied\" $ourverysecretpass = \"Dav\" $x = InputBox(\"Password\", \"Enter your password(Case sensitive)\", \"\", \"*\") If $x == $ourverysecretpass Then $access = \"Granted\" MsgBox(0, \"Accepted\", \"Stopped\") Else Do $x_second = InputBox(\"Password2\", \"Wrong password please enter your password(Case sensitive)\", \"\", \"*\") If $ourverysecretpass = $x_second Then $access = \"Granted\" MsgBox(0, \"Accepted2\", \"Stopped2\") ExitLoop EndIf $tryed += 1 Until $tryed = $counts EndIf If $access = \"Granted\" Then Else MsgBox(0,\"Password failled\", \"Will continue running\") endif Else EndFunc ;==>_exit Note: why is it full of backslashes? [center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center] 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