PDA

View Full Version : Closing multiple processes (1per1)


paul186
03-23-2009, 01:21 PM
------------------------------------------------------------------
------------ start closing processes-----------
-----------------------------------------------------------------
--read the text file that contains a proccess name per line for ex line 1: Skype.exe so read this and close al processes listed in the file
-------------------------------------------------------

ch_name = TextFile.ReadToTable("EocScanP.dll");

if (ch_name ~= nil) then

total = Table.Count(ch_name);
testvar = 1;

while (0 < total) do
--------------------------------------------------------------------------------
----------- cerrar los procesos --------------
-------------------------------------------------------------------------------
instances_of_file = 0;
file_to_check_for = ch_name[testvar]; --buscara ese archivo
processes = System.EnumerateProcesses();

for j, file_path in processes do
file = String.SplitPath(file_path);
if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
System.TerminateProcess(j);
end
end
-----------------------------------------------------------------------------------

total = total - 1;
testvar = testvar + 1;
end




end
--------------------------------------------------------------------
------------ end closing processes----------------------------
--------------------------------------------------------------------
why this code didnt work? i want to read some processes names listed on a textfile and close them all

holtgrewe
03-23-2009, 01:42 PM
paul186
What is the name of the text file you are trying to load into a table? Surely the file name isn't EocScanP.dll. A DLL file is not normally a text file. I'm not familiar with that dll - perhaps it creates the text file you are looking for?

paul186
03-23-2009, 02:49 PM
paul186
What is the name of the text file you are trying to load into a table? Surely the file name isn't EocScanP.dll. A DLL file is not normally a text file. I'm not familiar with that dll - perhaps it creates the text file you are looking for?

yeah it is but i change the extension from txt to dll so lot of people dont try to modify or read it

mwreyf1
03-24-2009, 09:41 AM
Try this...


Process_Name_List = TextFile.ReadToTable("D:\\Desktop\\EocScanP.dll");

if (Process_Name_List ~= nil) then
for e, proccess in Process_Name_List do
running_processes = System.EnumerateProcesses();
for j, file_path in running_processes do
file = String.SplitPath(file_path);
if (String.Lower(file.Filename..file.Extension)) == proccess then
System.TerminateProcess(j);
end
end
end
end

Remember that ALL entries in the EocScanP.dll must be in LOWERCASE only.