Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function selBrowser(playerStr,browserStrs)
- if type(browserStrs)=='string' then browserStrs = {browserStrs} end
- if type(browserStrs)~='table' then browserStrs = {'.'} end -- match all process name
- assert(type(playerStr)=='string',"invalid input")
- playerStr=playerStr:lower()
- local ps = createStringlist()
- getProcesslist(ps)
- for i=ps.Count-1,0,-1 do -- reverse order, so in general last started process check 1st
- local pid,pname = ps[i]:match('^(%x+)%-(.+)')
- local modules
- pid = tonumber(pid,16) -- need to be number type for enumModules
- for j=1,#browserStrs do
- if pname:lower():match(browserStrs[j]:lower()) then
- modules = modules or enumModules(pid)
- for k=1,#modules do
- if modules[k].Name:lower():match(playerStr) then
- ps.Destroy()
- return pid,pname
- end
- end
- end
- end
- end
- ps.Destroy()
- end
- print(tostring(selBrowser('flash','chrome') or 0))
- print(tostring(selBrowser('flash',{'firefox','chrome'}) or 0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement