triviet4 Posted November 17, 2015 Share Posted November 17, 2015 I have code ProcessClose 1 File when press Hot keyHotKeySet("{F6}","exitt") Do ToolTip("test",0,0) Until 0 Func exitt() ProcessClose ("File.exe") EndFuncPlease, help me, with code ProcessClose all File running on windows but may except for 1,2 Process when press Hot key Link to comment Share on other sites More sharing options...
water Posted November 17, 2015 Share Posted November 17, 2015 Welcome to AutoIt and the forum!Please have a look at function ProcessList. Loop through the array and close all processes but the 1, 2. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
triviet4 Posted November 17, 2015 Author Share Posted November 17, 2015 (edited) i cann't unknown ProcessList. At a time Turn on Computer, i will be different ProcessList As well as With shorcut:taskkill /F /FI "USERNAME eq user_name" /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne dwm.exe" Edited November 17, 2015 by triviet4 Link to comment Share on other sites More sharing options...
triviet4 Posted November 17, 2015 Author Share Posted November 17, 2015 (edited) I found this code. It's wrong or right + How add HotkeyLocal $sProcessList = ProcessList() For $i=0 To UBound($sProcessList)-1 CloseProcess($sProcessList[$i][0]) Next Func CloseProcess($sProcess) Local $sListProcessSystem=StringSplit("smss.exe|csrss.exe|wininit.exe|services.exe|lsass.exe|svchost.exe|spoolsv.exe|MsMpEng.exe|NisSrv.exe|dasHost.exe|SearchIndexer.exe|OSPPSVC.EXE|audiodg.exe|winlogon.exe|dwm.exe|taskeng.exe|sihost.exe|taskhostw.exe|RuntimeBroker.exe|ShellExperienceHost.exe|SearchUI.exe|SettingSyncHost.exe|SearchProtocolHost.exe|WUDFHost.exe|InstallAgent.exe|WmiPrvSE.exe|HxTsr.exe|SearchFilterHost.exe|rundll32.exe|", "|") For $x=0 To UBound($sListProcessSystem)-1 If Not StringInStr($sProcess,$sListProcessSystem[$x]) Then ConsoleWrite("ProcessClose: " & $sProcess&@CRLF) ProcessClose($sProcess) EndIf Next EndFunc Edited November 17, 2015 by triviet4 Link to comment Share on other sites More sharing options...
Trong Posted November 17, 2015 Share Posted November 17, 2015 Opt("TrayAutoPause", 0) HotKeySet("{F6}", "CloseProcess") HotKeySet("{F7}", "_Exit") While 1 Sleep(10) ToolTip("F6: CloseProcess - F7: Exit", @DesktopWidth / 2, @DesktopHeight / 2, "", 2, 2) WEnd Func CloseProcess() Local $sProcessList = ProcessList() For $i = 0 To UBound($sProcessList) - 1 _CloseProcess($sProcessList[$i][0]) Next EndFunc ;==>CloseProcess Func _CloseProcess($sProcess) Local $sListProcessSystem = StringSplit(@ScriptName & "|AutoIt3.exe|SciTE.exe|dllhost.exe|UniKey.exe|explorer.exe|smss.exe|csrss.exe|wininit.exe|services.exe|lsass.exe|svchost.exe|spoolsv.exe|MsMpEng.exe|NisSrv.exe|dasHost.exe|SearchIndexer.exe|OSPPSVC.EXE|audiodg.exe|winlogon.exe|dwm.exe|taskeng.exe|sihost.exe|taskhostw.exe|RuntimeBroker.exe|ShellExperienceHost.exe|SearchUI.exe|SettingSyncHost.exe|SearchProtocolHost.exe|WUDFHost.exe|InstallAgent.exe|WmiPrvSE.exe|HxTsr.exe|SearchFilterHost.exe|rundll32.exe", "|") Local $sTrue = False For $x = 0 To UBound($sListProcessSystem) - 1 If $sProcess = $sListProcessSystem[$x] Then $sTrue = True Next If Not $sTrue Then ConsoleWrite("ProcessClose: " & $sProcess & @CRLF) ToolTip("ProcessClose: " & $sProcess, @DesktopWidth / 2, @DesktopHeight / 2, "", 2, 2) ProcessClose($sProcess) EndIf EndFunc ;==>_CloseProcess Func _Exit() Exit EndFunc ;==>_Exit Regards, Link to comment Share on other sites More sharing options...
triviet4 Posted November 17, 2015 Author Share Posted November 17, 2015 (edited) Code of "Trong" is good. Thank's very muchBut when i play game CrossFire, FPS game fullscreen, code didn'tI have Alt+tab, code can do that (ProcessClose game)How fix it. Help me, Please Edited November 17, 2015 by triviet4 Link to comment Share on other sites More sharing options...
Trong Posted November 17, 2015 Share Posted November 17, 2015 Try running with Adminstrator.The game was too big I can not download and run the test. (Maximum download speed is 400KB/s)#RequireAdmin Regards, 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