Jump to content

Terminate a windows process that has a specific window name


keashdoc
 Share

Recommended Posts

Hi,

I am trying to write an Autoit Code that will find a window with a specific caption and delete the process associated with that window.  However, I am unable to find any code that does this. I tried this but it doesn't do the job.   Any other ideas how I can accomplish this?  Thanks. 

 

Global Const $partialCaption = "PartialCaption" ; Change this to the partial caption of the window you want to find

While 1
    If WinExists($partialCaption) Then
        Local $hWnd = WinGetHandle($partialCaption)
        If $hWnd <> 0 Then
            ProcessClose(WinGetProcess($hWnd))
            ; Add a Sleep to avoid rapidly closing processes
            Sleep(1000)
        EndIf
    EndIf
    Sleep(1000)
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...