Guest gcyeaw Posted November 15, 2004 Posted November 15, 2004 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
this-is-me Posted November 15, 2004 Posted November 15, 2004 Open task manager and see if the target process to kill is running with a username of "SYSTEM" or "NETWORK SERVICE". If it is, then you may not be able to kill it using autoit unless autoit has the correct admin rights. Who else would I be?
Guest Toba Posted December 17, 2004 Posted December 17, 2004 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
GaryFrost Posted December 17, 2004 Posted December 17, 2004 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.
Guest Toba Posted December 17, 2004 Posted December 17, 2004 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 scriptsNo, but the process isn't closing, even if I watch at the taskmanager after running my script 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 helpBest regardsThomas
ezzetabi Posted December 17, 2004 Posted December 17, 2004 (edited) 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 homepageOps... I arrived late. Well... Pskill maybe useful when you are not using WinXP systems. Edited December 17, 2004 by ezzetabi
MHz Posted December 17, 2004 Posted December 17, 2004 Window XP Pro has Taskkill. Windows XP Home does not have Taskkill, so PSKill is good recommendation then.
sugi Posted December 17, 2004 Posted December 17, 2004 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now