Sign in to follow this  
Followers 0
lavezzi

Kill process from window title?

5 posts in this topic

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

Share this post


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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

RAWR! I'm hungry :( Feed the panda squirrle

Share this post


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

Share this post


Link to post
Share on other sites

:) I didn't know you could do that >_>

Interesting...

That should work the best I guess


RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
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
Sign in to follow this  
Followers 0