--在全局函数中增加 适用用Setup Factory 9

function FindAndCloseProcessByName(strName)
  local tblProcesses = Window.EnumerateProcesses(false);
  local bProcessFound = false;
  local nProcessHandle = nil; 
if Table.Count(tblProcesses) > 0 then
 local strProcessName;
 local nHandle;
 for nHandle,strProcessName in pairs(tblProcesses) do
  if(String.Find(strProcessName,strName,1,false) ~= -1)then
  nProcessHandle = nHandle;
  bProcessFound = true;
  end
 end
end
if(bProcessFound and nProcessHandle)then
 Window.Close(nProcessHandle,CLOSEWND_TERMINATE); 
end
end

 

--调用

FindAndCloseProcessByName("DMS_Client.exe");
FindAndCloseProcessByName("DMSAutoUpdate.exe");

 

 

--或者直接调用

 

strName = "Lx_Update.exe";
tblProcesses = Window.EnumerateProcesses(false);
bProcessFound = false;
nProcessHandle = nil;
if(tblProcesses)then
for nHandle, strProcessName in pairs(tblProcesses) do
  if(String.Find(strProcessName,strName,1,false) ~= -1)then
   nProcessHandle = nHandle;
   bProcessFound = true;
  end
end
end

if(bProcessFound and nProcessHandle)then
Window.Close(nProcessHandle,CLOSEWND_TERMINATE);
end

相关文章:

  • 2021-12-27
  • 2021-11-23
  • 2019-09-02
  • 2021-11-12
  • 2021-12-15
  • 2021-12-26
  • 2021-11-19
猜你喜欢
  • 2021-11-02
  • 2021-08-07
  • 2021-11-16
  • 2021-05-12
  • 2021-11-06
  • 2021-11-02
  • 2021-05-28
  • 2021-08-29
相关资源
相似解决方案