Jump to content

Recommended Posts

Posted

I'm a complete noob so please be gentle.

I would like to create a script that will close an app for me. When I open Task Manager I can see the app I wish to close under "Apps" and under "Background processes".

I figured out that ProcessClose ( "process" )  will close a process under "Apps" and WinClose ( "title" [, "text"] ) will close a process under "Windows processes" but I can't find anything that will close a process under "Background processes".

I've tried searching for this topic but ended up with very old out of date information that no longer works or badly titled topics that don't help (a lot of badly titled topics out there).

 

 

Posted (edited)

@CatSauce01

Welcome to Autoit Forum ,all you need to do is following:

if you want to close process by name use:

ProcessClose("notepad.exe");name of the process is notepad followed by .exe

if you want to close Win App use:

WinClose('Untitled - Notepad');close win app by it's title

if you want to close process by pid use:

ProcessClose(6531);pid of the process is 6531

if you want to close Multi process by name use:

;Close Multi Process by Name
Local $arr = ProcessList("notepad.exe") ;
For $i = 1 To $arr[0][0]
    ProcessClose($arr[$i][1]);close process by Pid of Process name
Next

 

Edited by ad777

none

Posted
19 minutes ago, Jos said:

ProcessClose() will try to kill any process with that name.

Give us a real example with code that isn't working.

Jos

It's working to an extent. ProcessClose("CatSauce.exe") will close it under "Apps" in Task Manager but wont close the CatSauce.exe process under "Background processes".

I'm guessing ad777 is telling me to got to Details in Task Manager and find the pid for the CatSauce.exe process under "Background processes".

Posted
1 minute ago, Jos said:

Yes it will when you have the rights for it. You could always try #RequireAdmin at the top of the script to ensure it runs with elevated rights. :) 

Really? I checked CatSauce.exe security and it has full permission. I'll add #RequireAdmin just incase.

Posted

I've tried all your suggestions with #RequireAdmin included and I still can't close CatSauce background process. I still have to manually open Task Manager, find CatSauce under "Background processes" and end task there.

Posted
3 hours ago, ad777 said:

@CatSauce01

Welcome to Autoit Forum ,all you need to do is following:

if you want to close process by name use:

ProcessClose("notepad.exe");name of the process is notepad followed by .exe

if you want to close Win App use:

WinClose('Untitled - Notepad');close win app by it's title

if you want to close process by pid use:

ProcessClose(6531);pid of the process is 6531

if you want to close Multi process by name use:

;Close Multi Process by Name
Local $arr = ProcessList("notepad.exe") ;
For $i = 1 To $arr[0][0]
    ProcessClose($arr[$i][1]);close process by Pid of Process name
Next

 

 

2 hours ago, Jos said:

Yes it will when you have the rights for it. You could always try #RequireAdmin at the top of the script to ensure it runs with elevated rights. :) 

 

1 hour ago, Nine said:

You may also try this, if everything does not work :

Local $iRet = RunWait ("TaskKill /IM CatSauce.exe /F", "", @SW_HIDE)
ConsoleWrite("$iRet = " & $iRet & @CRLF)

with or without #RequireAdmin

I've tried all your suggestions with #RequireAdmin included and I still can't close CatSauce background process. I still have to manually open Task Manager, find CatSauce under "Background processes" and end task there.

Posted (edited)
Posted
3 hours ago, Nine said:

Can you screen capture the part where CatSauce.exe is running in background (from task manager) and post the image here.  Also post the code you are using that do not work.

I finally figured it out and now it's working great. Made some rookie mistakes 🤦‍♂️ which I'm really embarrassed about.

Thank you to everyone who kindly helped me out on this.

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
  • Recently Browsing   0 members

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