Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Need help, script to do process list selection

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Apr 12, 2015 12:21 pm    Post subject: Need help, script to do process list selection Reply with quote

Hii guys,
Does anyone can help me with an example of a script, how to make a selection a process a from memory active process list as show in the picture attached.
Thanks and regards


Last edited by Corroder on Sat May 30, 2015 1:16 am; edited 1 time in total
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Sun Apr 12, 2015 1:48 pm    Post subject: This post has 1 review(s) Reply with quote

Code:
--


function pidDialog(doPid)

  local plugname = {"iexplore","flashplayerplugin","plugin-container","opera","chrome","awesomium_process","torch","dragon","maxthon","palemoon","safari" }
  local function tmerge(t,o,...) for k,v in pairs(o) do t[k]=v end if select('#',...)>0 then return tmerge(t,...) else return t end end
  local function callLater(f,...)
    local t = createTimer()
    local a,n = {...},select('#',...)
    t.Interval = 100
    t.OnTimer = function(sender) sender.Enabled=false sender.Destroy() f(unpack(a,1,n)) end
    t.Enabled = true
    return t
  end
  local function parseProc(s)
    local p,n
    for pid,name in string.gmatch(s,'([0-9A-F]+)-(.*)') do
      p = pid ; n = name
    end
    return  p,n
  end
  local function prec(i,p,n)
    local weight = 0
    for _,v in ipairs(plugname) do
      if string.find(string.lower(n),string.lower(v),1,true) then weight = weight + 1 end
    end
    return {pid=p,desc=string.format('%5d-%04X-%s',p,p,n),name=n,w=weight+i/2048}
  end

  local FP = createForm(false)
  tmerge(FP,{FormStyle='fsStayOnTop',AutoSize=true,BorderWidth=4,Color=0x80,Position='poScreenCenter',BorderStyle='bsToolWindow',Caption='Double Click to Select'})
  local LB = createListBox(FP)
  tmerge(LB,{MultiSelect=false,AutoSize=true,Color=0x80})
  local cs = LB.Constraints
  tmerge(cs,{MinHeight=300,MinWidth=400})
  local fn = LB.Font
  tmerge(fn,{Color=0xffffff,Name='Courier New',Height=-16,Style='[bsBold]'})

  LB.OnDblClick = function()
    local idx,PID,NAME = LB.ItemIndex,nil,''
    if idx >= 0 then
      for pid,pID,name in string.gmatch(LB.Items[idx],'([0-9]+)-\s*([0-9A-F]+)-(.*)') do
        PID = tonumber(pid,10)
        NAME = name
      end
    end
--    print(tostring(PID))
    if PID ~= nil then callLater(doPid,PID,NAME) end
    FP.close()
  end -- LB.OnDblClick

  FP.OnClose = function()  FP.destroy(); FP = nil end

  getProcesslist(LB.Items)
  local plist = {}
  for i=1,LB.Items.getCount() do
    local p,n = parseProc(LB.Items[i-1])
    p = tonumber(p,16)
    table.insert(plist,prec(i,p,n))
  end

  table.sort(plist,function(a,b) return a.w > b.w end)
  local currProcId = getOpenedProcessID()
  for i=1,LB.Items.getCount() do
    LB.Items.setString(i-1,plist[i].desc)
    if plist[i].pid == currProcId then LB.setItemIndex(i-1) end
  end

  FP.show()
end

-- usage:

--pidDialog(print)

--pidDialog(openProcess)

pidDialog(function(pid,name) print(string.format('%04X-%s',pid,name)) end)
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Apr 12, 2015 8:23 pm    Post subject: Process List Reply with quote

Dear Panraven bro,

I am very grateful for the code you give .
It work like a charm as usually like CE trainers you made. Your trainer for a game, still use by many peoples and still work till now.

Thank you and regards...
Back to top
View user's profile Send private message
tomtinhte
How do I cheat?
Reputation: 0

Joined: 27 Aug 2014
Posts: 8

PostPosted: Thu Apr 16, 2015 9:25 am    Post subject: Reply with quote

panraven wrote:
Code:
--


function pidDialog(doPid)

  local plugname = {"iexplore","flashplayerplugin","plugin-container","opera","chrome","awesomium_process","torch","dragon","maxthon","palemoon","safari" }
  local function tmerge(t,o,...) for k,v in pairs(o) do t[k]=v end if select('#',...)>0 then return tmerge(t,...) else return t end end
  local function callLater(f,...)
    local t = createTimer()
    local a,n = {...},select('#',...)
    t.Interval = 100
    t.OnTimer = function(sender) sender.Enabled=false sender.Destroy() f(unpack(a,1,n)) end
    t.Enabled = true
    return t
  end
  local function parseProc(s)
    local p,n
    for pid,name in string.gmatch(s,'([0-9A-F]+)-(.*)') do
      p = pid ; n = name
    end
    return  p,n
  end
  local function prec(i,p,n)
    local weight = 0
    for _,v in ipairs(plugname) do
      if string.find(string.lower(n),string.lower(v),1,true) then weight = weight + 1 end
    end
    return {pid=p,desc=string.format('%5d-%04X-%s',p,p,n),name=n,w=weight+i/2048}
  end

  local FP = createForm(false)
  tmerge(FP,{FormStyle='fsStayOnTop',AutoSize=true,BorderWidth=4,Color=0x80,Position='poScreenCenter',BorderStyle='bsToolWindow',Caption='Double Click to Select'})
  local LB = createListBox(FP)
  tmerge(LB,{MultiSelect=false,AutoSize=true,Color=0x80})
  local cs = LB.Constraints
  tmerge(cs,{MinHeight=300,MinWidth=400})
  local fn = LB.Font
  tmerge(fn,{Color=0xffffff,Name='Courier New',Height=-16,Style='[bsBold]'})

  LB.OnDblClick = function()
    local idx,PID,NAME = LB.ItemIndex,nil,''
    if idx >= 0 then
      for pid,pID,name in string.gmatch(LB.Items[idx],'([0-9]+)-\s*([0-9A-F]+)-(.*)') do
        PID = tonumber(pid,10)
        NAME = name
      end
    end
--    print(tostring(PID))
    if PID ~= nil then callLater(doPid,PID,NAME) end
    FP.close()
  end -- LB.OnDblClick

  FP.OnClose = function()  FP.destroy(); FP = nil end

  getProcesslist(LB.Items)
  local plist = {}
  for i=1,LB.Items.getCount() do
    local p,n = parseProc(LB.Items[i-1])
    p = tonumber(p,16)
    table.insert(plist,prec(i,p,n))
  end

  table.sort(plist,function(a,b) return a.w > b.w end)
  local currProcId = getOpenedProcessID()
  for i=1,LB.Items.getCount() do
    LB.Items.setString(i-1,plist[i].desc)
    if plist[i].pid == currProcId then LB.setItemIndex(i-1) end
  end

  FP.show()
end

-- usage:

--pidDialog(print)

--pidDialog(openProcess)

pidDialog(function(pid,name) print(string.format('%04X-%s',pid,name)) end)

Hi bro. I've tried to create a button. but I can't call FP. show ()... You can create an example = .CT file? Thanks!
Back to top
View user's profile Send private message Yahoo Messenger
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Thu Apr 16, 2015 12:30 pm    Post subject: Reply with quote

The function pidDialog will call the FP form itself.

...anyway, a .ct demo...



procList2.ct
 Description:
test

Download
 Filename:  procList2.ct
 Filesize:  5.01 KB
 Downloaded:  593 Time(s)

Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Apr 18, 2015 2:11 am    Post subject: Fuction process list to trainer Reply with quote

Dear Panraven bro,

Would you help to modified my CT file with put your process list function script into my trainer ?.

That will be great and very useful help from you. Also its a very good lesson for me as a beginner start to learn to make CE trainer and script.

Thank you


Last edited by Corroder on Sat May 30, 2015 1:17 am; edited 1 time in total
Back to top
View user's profile Send private message
tomtinhte
How do I cheat?
Reputation: 0

Joined: 27 Aug 2014
Posts: 8

PostPosted: Sat Apr 18, 2015 12:30 pm    Post subject: Reply with quote

panraven wrote:
The function pidDialog will call the FP form itself.

...anyway, a .ct demo...

It's very useful.. thanks again bro! Razz
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites