Jump to content

how to close two apps with one hotkey?


Recommended Posts

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!

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

  • Developers

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?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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