Jump to content

Kill process from window title?


Recommended Posts

Hello, knowing the title of a window is there a command to kill the correspondant process?

I've got an app tha somethime stops working and I need to be killed with out any confirmation, I wanna kill it if I was killing the process.

ty

Link to comment
Share on other sites

Hello, knowing the title of a window is there a command to kill the correspondant process?

I've got an app tha somethime stops working and I need to be killed with out any confirmation, I wanna kill it if I was killing the process.

ty

Look at the Winclose command and process close command in conjunction.

for example

$windowtitle = "MyWindow"

$processname = "Myprocess"

if WinExists ( $windowtitle) Then

processclose($processname)

endif

Link to comment
Share on other sites

Also, you should look at WinKill()

From the help file: Function WinKill: The difference between this function and WinClose is that WinKill will forcibly terminate the window if it doesn't close quickly enough. Consequently, a user might not have time to respond to dialogs prompting the user to save data. Although WinKill can work on both minimized and hidden windows, some windows (notably explorer windows) can only be terminated using WinClose.

Edited by mistersquirrle

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

I think you are looking for the WinGetProcess() command to be used with ProcessClose().

For example, this would close the process of any window with the title "Untitled - Notepad"

$WinTitle = 'Untitled - Notepad'

While 1
    If WinExists( $WinTitle ) Then
        ProcessClose(WinGetProcess( $WinTitle ))
    EndIf
    Sleep(10)
WEnd
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...