Page 1 of 1

Process Killer

Posted: Sat Mar 04, 2017 4:34 am
by corroder
Hi there,
This script is to get and attach process to CE.

Code: Select all

--- Process Handler
function GetTheProcessList()
 local T = {}
 local SL=createStringlist()
 getProcesslist(SL)
 for i=0,strings_getCount(SL)-1 do
  T[i] = strings_getString(SL,i)
 end
 return T
end

function GetPros(sender)
 local PL = GetTheProcessList()
 local S = {}
 local variable = drop.text
 list.Clear()
 for x = 0, #PL do
  if variable == "All" then
  list.Items.Add(PL[x])
  else
  if string.sub(PL[x],10) == variable then
  --S[#S+1] = PL[x]  --list for reference
  list.Items.Add(PL[x])
  end
  end
 end
end

function OpenPro()
 local a = list.ItemIndex
 if a ~= -1 then
 local b = string.sub(list.Items[a],0,8)
 b = tonumber(b,16)
 openProcess(b)
 else
 showMessage("Process not found...")
 return
 end
end
Now I try to make function process killer..

Code: Select all

function KillPro()
 local a = list.ItemIndex
 if a ~= -1 then
 local b = string.sub(list.Items[a],0,8)
 b = tonumber(b,16)
 shellExecute(string.format(b), '/c taskkill /PID ' .. getOpenedProcessID(), nil, false)
 else
 showMessage("Process not found...")
 return
 end
end
Is function KillPro() correct or is there any other way to kill a ran process ?

Thanks