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 


How To Auto Attach to Browser

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
HyberCode
Cheater
Reputation: 0

Joined: 17 Feb 2016
Posts: 40

PostPosted: Tue Feb 23, 2016 5:21 pm    Post subject: How To Auto Attach to Browser Reply with quote

Hello
i need function that check in all processes that has name (chrome.exe) .. and open the correct process that use Flash player plug (any flash Game)

thank you Smile
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Tue Feb 23, 2016 9:27 pm    Post subject: Reply with quote

This return the pid of 1st found process with matching browser name which having a matching dll name of a flash/unity player.

Code:
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))


It return nil if found nothing, so please check if it return a valid pid before openProcess, for example.

_________________
- Retarded.
Back to top
View user's profile Send private message
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