au3scr Posted April 12, 2008 Share Posted April 12, 2008 (edited) #include <Process.au3> $pid = 0 For $i=1 To 3000 $kill = _ProcessGetName($pid) if $pid <> "killall.exe" Then ProcessClose($pid) $pid= $pid +1 Next I need help with that script,I made it to kill all progresses but it reset-s machine (force restart) how i can make it so that it only kills tasks? You need compile it 1-st Edited April 12, 2008 by au3scr Link to comment Share on other sites More sharing options...
covaks Posted April 12, 2008 Share Posted April 12, 2008 Try this maybe: $var = WinList() For $i = 1 to $var[0][0] If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then If Not StringInStr($var[$i][0],"Program Manager") Then WinKill($var[$i][0]) EndIf EndIf Next Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Link to comment Share on other sites More sharing options...
qazwsx Posted April 12, 2008 Share Posted April 12, 2008 also when using a for loop, the variable (in your case $i) increments with each step. So you do now need a second varialbe to increase every time. Simply use $i instead of $pid. Link to comment Share on other sites More sharing options...
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