NELyon Posted June 26, 2006 Share Posted June 26, 2006 If i have two or more of the same processes open, is it possible to kill all but one of them using ProcessKill()? ProcessKill will close all of them. If i can get this figured out, i can start programming more IE crap. Link to comment Share on other sites More sharing options...
GaryFrost Posted June 26, 2006 Share Posted June 26, 2006 if you have the pids to the processes you could use process close to kill each individual processhttp://www.autoitscript.com/forum/index.ph...mp;#entry114302http://www.autoitscript.com/forum/index.ph...st&p=200025 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 More sharing options...
NELyon Posted June 26, 2006 Author Share Posted June 26, 2006 ok, i'm going to a different question instead. Is it possible to close all IE windows except one specified in a variable? i think this was answered before but i searched and couldn't find it Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 26, 2006 Moderators Share Posted June 26, 2006 ok, i'm going to a different question instead. Is it possible to close all IE windows except one specified in a variable? i think this was answered before but i searched and couldn't find itHighLander Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
NELyon Posted June 26, 2006 Author Share Posted June 26, 2006 Lol, thanks smoke Link to comment Share on other sites More sharing options...
NELyon Posted June 26, 2006 Author Share Posted June 26, 2006 wait... it won't work Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 26, 2006 Moderators Share Posted June 26, 2006 wait... it won't workDid you try to mod it? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
NELyon Posted June 26, 2006 Author Share Posted June 26, 2006 no Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 26, 2006 Moderators Share Posted June 26, 2006 (edited) _WinCloseSpecial('iexplore.exe', 'Some Name To Keep') Func _WinCloseSpecial($sExe, $sWinKeep) $OptWTMM = Opt('WinTitleMatchMode', 2) $sWinKeep = WinGetHandle($sWinKeep) Local $aWinList = WinList(), $aProcList = ProcessList() Local $aStoreProcess = '' For $xCount = 1 To $aProcList[0][0] If $aProcList[$xCount][0] = $sExe Then $aStoreProcess &= $aProcList[$xCount][1] & Chr(01) Next $aStoreProcess = StringSplit(StringTrimRight($aStoreProcess, 1), Chr(01)) For $iCount = 1 To $aWinList[0][0] For $xCount = 1 To UBound($aStoreProcess) - 1 If WinGetProcess($aWinList[$iCount][0]) = $aStoreProcess[$xCount] Then If $aWinList[$iCount][1] <> $sWinKeep Then WinClose($aWinList[$iCount][1]) EndIf EndIf Next Next Opt('WinTitleMatchMode', $OptWTMM) EndFunc Edit: Wish I had read this: noBefore I posted. Edited June 26, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
NELyon Posted June 26, 2006 Author Share Posted June 26, 2006 lol Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 26, 2006 Moderators Share Posted June 26, 2006 This should work #include <IE.au3> ; prevent object error from terminating your script _IEErrorHandlerRegister () ; create a visible browser window and navigate to a webpage $oIE = _IECreate ("www.autoitscript.com") ; get the hwnd of the browser window $hIE = _IEPropertyGet ($oIE, "hwnd") _KillExistingIE($hIE, 1) Func _KillExistingIE($h_hwnd, $w_Kill_Close = 0) $w_Winlist = WinList() For $i = 1 To $w_Winlist[0][0] If StringInStr($w_Winlist[$i][0], "Microsoft Internet Explorer") And $w_Winlist[$i][1] <> $h_hwnd Then If $w_Kill_Close = 0 Then WinKill($w_Winlist[$i][1]) Else WinClose($w_Winlist[$i][1]) EndIf EndIf Next EndFunc ;==>_KillExistingIE Link to comment Share on other sites More sharing options...
AutoItKing Posted June 26, 2006 Share Posted June 26, 2006 You could try my _ShutDown script? http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 26, 2006 Moderators Share Posted June 26, 2006 This should work #include <IE.au3> ; prevent object error from terminating your script _IEErrorHandlerRegister () ; create a visible browser window and navigate to a webpage $oIE = _IECreate ("www.autoitscript.com") ; get the hwnd of the browser window $hIE = _IEPropertyGet ($oIE, "hwnd") _KillExistingIE($hIE, 1) Func _KillExistingIE($h_hwnd, $w_Kill_Close = 0) $w_Winlist = WinList() For $i = 1 To $w_Winlist[0][0] If StringInStr($w_Winlist[$i][0], "Microsoft Internet Explorer") And $w_Winlist[$i][1] <> $h_hwnd Then If $w_Kill_Close = 0 Then WinKill($w_Winlist[$i][1]) Else WinClose($w_Winlist[$i][1]) EndIf EndIf Next EndFunc ;==>_KillExistingIEWould that work if there were more than one .exe running? I had something similar until I thought about that, and the PID being different. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 26, 2006 Moderators Share Posted June 26, 2006 It worked for me, I opened three different browsers, then ran the script. All but the one that was created were closed. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 26, 2006 Moderators Share Posted June 26, 2006 It worked for me, I opened three different browsers, then ran the script. All but the one that was created were closed.Yeah, I'm sorry, I should have said something... I noticed the StringInStr() with Internet Explorer there, that takes care of that. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
NELyon Posted June 26, 2006 Author Share Posted June 26, 2006 thanks! 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