--在全局函数中增加 适用用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-10-02
  • 2022-12-23
  • 2021-08-04
  • 2021-04-26
  • 2021-05-12
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-28
  • 2021-07-20
  • 2021-09-13
  • 2021-05-11
  • 2021-12-06
  • 2021-08-24
相关资源
相似解决方案