Jump to content

ProcessClose


Guest gcyeaw
 Share

Recommended Posts

I compiled the following, pretty much a cut and paste of the example with a different process name. When I execute it, it obtains the PID and follows the 'then' leg of the if statement. It displays the PID in the message box, but the process is not closed. What am I missing here?

Windows XP SP2

$PID = ProcessExists("X10nets.exe") ; Will return the PID or 0 if the process isn't found.

if $PID Then

ProcessClose($PID)

MsgBox(4096, $PID, "This box will time out in 5 seconds", 5)

else

MsgBox(4096, "X10nets did not exist", "This box will time out in 5 seconds", 5)

endif

Link to comment
Share on other sites

  • 1 month later...

Hi,

I've got the same problem. Is there a way around? I mean, AutoIt is run as Administrator, so how much more rights can it have? I'm logged in as Administrator too and can easily kill the process in question. So how do I allow AutoIt to do it?

Best regards

Thomas Bartz

Link to comment
Share on other sites

Have you tried a loop with a sleep to give the process time to die?

Not sure if this will help, had to something similiar with other scripts

example:

$PID = ProcessExists("X10nets.exe") ; Will return the PID or 0 if the process isn't found.

While($PID)

ProcessClose($PID)

Sleep ( 1000 )

$PID = ProcessExists("X10nets.exe") ; Will return the PID or 0 if the process isn't found.

if $PID Then

MsgBox(4096, $PID, "This box will time out in 5 seconds", 5)

else

MsgBox(4096, "X10nets.exe did not exist", "This box will time out in 5 seconds", 5)

endif

Wend

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Have you tried a loop with a sleep to give the process time to die?

Not sure if this will help, had to something similiar with other scripts

No, but the process isn't closing, even if I watch at the taskmanager after running my script :idiot: It really seems, that ProcessClose can't kill all kind of processes und doesn't give any feedback about it.

While searching on in the forum I found the hint to use "taskkill", which serves my needs very well. So if anyone else has got the same problem again, he should try to use the following:

Run(@ComSpec & " /c taskkill /IM wmiprvse.exe /F")

Thanks for your help

Best regards

Thomas

Link to comment
Share on other sites

Thats it Toba 'ProcessClose' does not KILL processes, just close them in the kind way. If a process don't want to close 'ProcessClose' will not close it.

Solution, use a external utility called 'Pskill', is a command line utility easy to implement in a script and it is much stronger even that the usual Task Manage 'End Process'.

Link to PSline homepage

Ops... I arrived late. Well... Pskill maybe useful when you are not using WinXP systems. :idiot:

Edited by ezzetabi
Link to comment
Share on other sites

I've got the same problem. Is there a way around? I mean, AutoIt is run as Administrator, so how much more rights can it have? I'm logged in as Administrator too and can easily kill the process in question. So how do I allow AutoIt to do it?

Members of the Administrators group don't have full rights. On windows the simplest way would be to create a service, start this service and let it do its task (the ProcessClose) and then removing the service again. That's what pskill does and that's pretty much the only way I know about to close a program not running as your user.
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...