Sign in to follow this  
Followers 0
PTCL

how to close two apps with one hotkey?

5 posts in this topic

hi,

this is my script of hotkey (Example).

;
HotKeySet("^!x","_exit");CTRL+ALT+X
#cs
while 1
;Do what ever you want to.
    Sleep(100);Don't max out the cpuf
WEnd
#CE
FileCopy("c:\1.txt", "c:\i_am_copied.txt")
WinWaitActive("MyProgram")
Func _exit()
    ConsoleWrite(""    & @CRLF)
    $counts = 3
    $tryed = 1
    $access =  "Denied"
    $ourverysecretpass =  "test"
    $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
;

i have used this script in two apps which runs at the same time but when

i presses CTRL+ALT+X then it closes only one app and after that never works again for the 2nd program.

anyone will tell me how can i close two programs at the same time by setting a hot key.

thanx!

Share this post


Link to post
Share on other sites



the main problem is that first program was terminated successfully but 2nd was not, i tried to press hotkey buttons again and again but it did not gave me any option or was not closed.

please help me out fast.

Share this post


Link to post
Share on other sites

hi ptcl

afaik, a hotkey can be registered only by one process at a time. So if you run the script twice (and have 2 processes) then the second process will overwrite the hotkey registration of the first process

Possible solutions:

1. build-in a management into your script which can handle multiple applications to close

2. use different hotkeys for the 2 scripts

maybe there's a better solution but i'd try that first

greetz, tannerli

Share this post


Link to post
Share on other sites

the main problem is that first program was terminated successfully but 2nd was not, i tried to press hotkey buttons again and again but it did not gave me any option or was not closed.

please help me out fast.

:) now why does this style of writing reminds me of somebody that resently got banned about 25 times?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

hi ptcl

afaik, a hotkey can be registered only by one process at a time. So if you run the script twice (and have 2 processes) then the second process will overwrite the hotkey registration of the first process

Possible solutions:

1. build-in a management into your script which can handle multiple applications to close

2. use different hotkeys for the 2 scripts

maybe there's a better solution but i'd try that first

greetz, tannerli

how can i build-in a management into my script which can handle multiple applications to close.

please help me on how can i set one hotkey to close two programs.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0