Jump to content

setting a hot key to terminate the script but it should ask for password.


Recommended Posts

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 by Jos07

Always Keep Your Sig Small... Like me :D

Link to comment
Share on other sites

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 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

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

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

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

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! you’re the best in town Fight!
Link to comment
Share on other sites

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

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! you’re the best in town Fight!
Link to comment
Share on other sites

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

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

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! you’re the best in town Fight!
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...