--================================ Main Menu ================================-- mf=MainForm local mainMenu = mf.Menu.Items local miMenu1 = createMenuItem(mf.MainMenu) miMenu1.Name = 'miMenu1' miMenu1.Caption = 'ProcessTable' mainMenu.insert(mainMenu.Count-1,miMenu1) --============================================================================-- --============================================================================-- --============================ Browser Memory ==============================-- local miMemory1 = createMenuItem(miMenu1) miMemory1.Caption = 'SelectProcess' miMenu1.add(miMemory1) --============================================================================-- function ProcessMemory(pro,ops) DP2=getScreenDPI()/97 if fr1 then fr1.destroy() f=nil end fr1 = createForm(false) fr1.Width=300*DP2 fr1.Height=250*DP2 fr1.Caption="Sorted Process List" setProperty(fr1 , "BiDiMode", "bdLeftToRight") fr1.Position=poDesktopCenter fr1.Font.Style="fsBold" fr1.Font.Color=0xffffff fr1.BorderStyle = "bsNone" fr1.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA ) fr1.Color=0x000100 local Btn11=createPanel(fr1) Btn11.Height=35*DP2 Btn11.Left=5*DP2 Btn11.Top=0*DP2 Btn11.Width=290*DP2 Btn11.Cursor= -22 Btn11.BevelWidth=3 Btn11.Color=0 Btn11.caption="Browser Memory List" Btn11.Font.Size=16*DP2 Btn11.Font.Color=0xffffff Btn11.OnMouseDown = function() fr1.DragNow() end local Btn1=createPanel(fr1) Btn1.Height=162*DP2 Btn1.Left=5*DP2 Btn1.Top=40*DP2 Btn1.Width=290*DP2 Btn1.BevelWidth=3 Btn1.Color=0 local Btn12=createPanel(fr1) Btn12.Height=43*DP2 Btn12.Left=5*DP2 Btn12.Top=205*DP2 Btn12.Width=290*DP2 Btn12.BevelWidth=3 Btn12.Color=0 local list = createListBox(Btn1) list.Height=90*DP2 list.Width=270*DP2 list.Left=10*DP2 list.Top=61*DP2 list.color=0 list.Font.Style="fsBold" local lx1 = createLabel(Btn1) lx1.AutoSize=false lx1.Height=45*DP2 lx1.Left=15*DP2 lx1.Top=4*DP2 lx1.Width=270*DP2 lx1.Font.Size=10*DP2 lx1.Font.Color=0xFFFFFF lx1.OptimalFill=true lx1.Font.Style="fsBold" lx1.Alignment= "taCenter" lx1.Cursor= -22 lx1.caption = 'Double-click the selection to confirm.\nOnaylamak için, seçimi çift tıklayın.' lx1.OnMouseDown = function() fr1.DragNow() end local lx3=createLabel(Btn1) lx3.Left=15*DP2 lx3.Top=45*DP2 lx3.Font.Size=10*DP2 lx3.Font.Color=0xFFFFFF lx3.Font.Style="fsBold" --lx3.OptimalFill=true --lx3.Font.Style="fsBold" lx3.caption="Memory - PID: - Process:" lx3.visible=true local Btn2=createPanel(Btn12) Btn2.Height=24*DP2 Btn2.Left=10*DP2 Btn2.Top=9*DP2 Btn2.Width=55*DP2 Btn2.BevelColor=16776960 Btn2.Caption="Search" Btn2.BevelWidth=3 Btn2.Color=0 local Btn3=createEdit(Btn12) Btn3.Height=29*DP2 Btn3.Left=70*DP2 Btn3.Top=9*DP2 Btn3.Width=80*DP2 Btn3.Text="chrome.exe" Btn3.Color=0 local Btn4=createPanel(Btn12) Btn4.Height=24*DP2 Btn4.Left=155*DP2 Btn4.Top=9*DP2 Btn4.Width=65*DP2 Btn4.BevelColor=16776960 Btn4.Caption="AllProcess" Btn4.BevelWidth=3 Btn4.Color=0 local Btn5=createPanel(Btn12) Btn5.Height=24*DP2 Btn5.Left=225*DP2 Btn5.Top=9*DP2 Btn5.Width=55*DP2 Btn5.BevelColor=16776960 Btn5.Caption="Close" Btn5.BevelWidth=3 Btn5.Color=0 function PanelCreate22(name22) name22.BevelColor=clDefault name22.BevelWidth=3 name22.Cursor=-21 name22.OnMouseMove=function() name22.BevelColor=4194559 end name22.OnMouseLeave=function() name22.BevelColor=clDefault end end PanelCreate22(Btn2) PanelCreate22(Btn5) PanelCreate22(Btn4) -------------------------------------------------------------- function process11(pro) if ops==1 then wanted_processes = { 'chrome.exe','plugin-container.exe','Facebook Gameroom Browser.exe', 'Maxthon.exe','opera.exe','brave.exe','firefox.exe','torch.exe','Farmville Two.exe', 'torch.exe','dragon.exe','palemoon.exe','safari.exe','iexplore.exe','msedge.exe' } end if ops==2 then wanted_processes = { pro } end if ops==3 then wanted_processes = { } end return wanted_processes end function ProcessMatch(s) for _,v in pairs(process11(pro)) do if s:match(v:lower()) then return true end end return false end function SortByKey(T,K,reverse) if reverse==true then table.sort(T, function(a,b) return a[K] > b[K] end) else table.sort(T, function(a,b) return a[K] < b[K] end) end return T end function filterprocess() local handle = io.popen( "tasklist.exe /fo csv" ) local processTable = {} local skip = true local tmp = nil if ops==1 or ops==2 then for line in handle:lines() do if skip then skip = false else tmp = {} for t in line:gmatch('\"(.-)\"') do table.insert(tmp,t) end local processName = tmp[1] if ProcessMatch(processName:lower()) then local PID = tmp[2] local MemoryUsage = tmp[5]:gsub("[^%d]",'')+0 -- +0 converts to number local entry = { processName=processName, PID=PID, MemoryUsage=MemoryUsage } processTable[#processTable+1] = entry end end end else for line in handle:lines() do n1,n2,n3,n4,n5 = line:match('"(.-)","(.-)","(.-)","(.-)","(.-)"') if n5~=nil then local processName = n1 local PID = n2 local MemoryUsage = (n5):gsub("%D",'') local mem1 = tonumber(MemoryUsage) if mem1~=nil then local entry = { processName=processName, PID=PID, MemoryUsage=tonumber(MemoryUsage) } processTable[#processTable+1] = entry end end end end handle:close() return SortByKey(processTable,'MemoryUsage',true) end function RefreshList1() local items = list.Items items.clear() currentprocesslist1 = filterprocess() if ( #currentprocesslist1 > 0 ) then for _,v in ipairs( currentprocesslist1 ) do strings_add(items, string.format('%.1f',v.MemoryUsage/1024)..' MB - '..v.PID..' - '..v.processName) end else return showMessage( "Couldn't find any useful process" ) end end function attaching() local a1 = list.ItemIndex local pro1 = list.Items if a1 == -1 then return end local process = pro1[a1] sleep(200) process1, process2 = string.match(process, '- (%d*) - (.*)') process1 = tonumber(process1) prc22=openProcess(process1) sleep(200) fr1.Close() end RefreshList1() list.onDblClick = attaching Btn2.OnClick=function() pro=Btn3.Text ops=2 RefreshList1() end Btn4.OnClick=function() ops=3 RefreshList1() end Btn5.OnClick=function() fr1.Close() end fr1.show() end miMemory1.onClick=function(sender) ProcessMemory("",3) end --============================================================================-- --============================================================================--