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 


[HELP] select process with ComboBox
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Wed Sep 16, 2020 9:42 pm    Post subject: Reply with quote

Aylin wrote:
I understood what he wanted to do.
CE does not connect to 2 processes at the same time, but if you register 2 processes, it will connect alternately.
You provide this registration with 2 codes.
First of all, you need the "processMemory" code from @ Corroder.
So you see the current pids of the two game windows.
Then you save these pids, "pid1 - pid2".
I will come to the pc in 1 week, I think this can be coded. Wink

yep master,you are right but i dont know what should i do, what code must i write hehe
would you help me master?

FIRELESS_BOUNTY wrote:
I think he means that he is trying to select the right game.
for example 1 main account and 1 alt account
he don't want to hack on main




Note :
don't forget "I think", it is just an opinion

yep master 1trainer for my main account and 1trainer for alt account even the game is same , my problem is : even i open 2 game there detect 1 process cause the name is same Very Happy,i dont think if i can run 2process at the same time in 1 trainer
but i think i can run 2game with 2 trainer

would you help me master?
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1246

PostPosted: Tue Sep 22, 2020 6:36 am    Post subject: This post has 1 review(s) Reply with quote

Here is the process solution for one Trainer, 2 players and 2 game windows.
Things you should know before using the code;
1) Add a button (for CEButton1 function) and a label (CELabel1 to print what game is in the process) to the Trainer.
2) Click the button if the additions above are complete.
3) Select the two processes from the drop down list box, and close the box form.
4) A hotkey has been specified, (F9) you can use this key to select which window process the Trainer should connect to.
5) You can edit the code as given or by integrating it into your own code.

Code:
local player1=""
local player2=""
local playerIndex="1"

function PlayerProcess(pro)
if brw then brw.destroy() end
brw=createForm(true)
brw.Position=poDesktopCenter brw.Width=280 brw.Height=160 brw.BorderStyle="bsNone"
setProperty(brw , "BiDiMode", "bdLeftToRight")

p15=createPanel(brw) p15.Height=brw.Height p15.Width=brw.Width p15.Left=0 p15.Top=0
p15.BevelInner="bvLowered" p15.BevelWidth=5 p15.BevelColor=0x008881
---------------------------------------------------

list = createListBox(p15) list.setSize(250, 60) list.setPosition(15,85) list.OptimalFill=true list.color=0x00FFFF
list.Font.Style="fsBold"

local lx1 = createLabel(p15)
lx1.AutoSize=false lx1.Height=60 lx1.Left=15 lx1.Top=35 lx1.Width=250
lx1.Font.Size=10 lx1.Font.Color=0x0000ff 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.\n PID:   -    Process:    -     Memory:                    '

local lx3=createLabel(p15)
lx3.AutoSize=false lx3.Left=45 lx3.Top=8 lx3.Height=35 lx3.Width=190
lx3.Font.Size=12 lx3.Font.Color=0x00000f lx3.Font.Style="fsBold" lx3.OptimalFill=true
lx3.Alignment="taCenter" lx3.caption="Player  Process  Select" lx3.visible=true lx3.Cursor=-22

p1=createPanel(p15) p1.Height=25 p1.Width=25 p1.Left=15 p1.Top=8
p2=createPanel(p15) p2.Height=25 p2.Width=25 p2.Left=240 p2.Top=8

-----------------------------------------------------------------

function panelcap22(item2, fsize, text, thint)
local item2 = item2
local color1 = "0xffff00"
item2.Font.Size=fsize item2.BevelInner="bvRaised" item2.BevelWidth=3 item2.Font.Color="0x000000"
item2.Font.Style="fsBold" item2.Hint=thint item2.ShowHint=true item2.OptimalFill=true item2.Tag=80
item2.Font.Name="Georgia" item2.Cursor=-21
item2.color = color1
item2.caption = text
item2.OnMouseMove=function() item2.color="0xffc000" end
item2.OnMouseLeave=function() item2.color=color1 end
end

panelcap22(p1, 9, "-", "Minimize Form")
panelcap22(p2, 9, "X", "Close Form")

------------------------------------------------------------------
brw.OnMouseDown = function() brw.DragNow() end
lx1.OnMouseDown = function() brw.DragNow() end
lx3.OnMouseDown = function() brw.DragNow() end

------------------------------------------------------------------
p1.OnClick=function(sender)
brw.WindowState = "wsMinimized"
end

p2.OnClick=function(sender)
  brw.close()
end
-------------------------( Thanks  @Corroder ) --------------------
 function filterprocess()
player1=""
player2=""
 local pro = pro..".exe"
 if pro == nil then showMessage(pro.." not found!"); end --return nil end

 local tasklist = io.popen"tasklist /fo csv /nh"
 local plist = {}
 local proc_item
 list.clear()

 for line in tasklist:lines() do
 local exe, pid, mem = line:match'^"(.-)","(%d+)",.-"([^"]+)"$'
 table.insert(plist, {pid = tonumber(pid), exe = exe, mem = tonumber((mem:gsub("%D", "")))})
 end

 tasklist:close()
 table.sort(plist, function(a, b) return a.mem > b.mem end)
 for j = 1, math.min(120, #plist) do
  if plist[j].exe == pro then
  proc_item = string.format(plist[j].pid..' - '..plist[j].exe..' - '..plist[j].mem..' Kb')
  list.Items.Add(proc_item)
  end
  end
  cn1 = list.Items.Count
 if cn1==0 then showMessage(pro.." not found!"); end

  end

function attaching()
local a = list.ItemIndex
local pro = list.Items[a]
local pid = pro:match('%d+');

if player1=="" then
player1=tonumber(pid)
print("player1 - PID: "..player1)
else
player2=tonumber(pid)
print("player2 - PID: "..player2)
end
end

filterprocess()
list.onDblClick = attaching
end

--CETrainer.CEButton1.OnClick=function()
PlayerProcess("chrome") --no .exe
--end

function openPlayer()
if player1=="" or player2=="" then
showMessage("The process is not specified in Player1 or Player2.\nPlease select the process for the two games.") end
if playerIndex=="1" then
playerIndex="2"
openProcess(player2)
CETrainer.CELabel1.caption=("Player2 - "..player2) --Trainer add CELabel?
else
playerIndex="1"
openProcess(player1)
CETrainer.CELabel1.caption=("Player1 - "..player1)
end
end

if processHotkey then processHotkey.Destroy() end
processHotkey=createHotkey(openPlayer, VK_F9)


EDIT:
Oops; You can ask yourself the question, "Which window did I choose as Player1?" Smile
I guess there was a code giving the "PID" process of the current window, now I don't remember.
If it does matter to you, you should get that code. Wink

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Mon Oct 05, 2020 9:32 pm    Post subject: Reply with quote

sorry master i have been try make process list again but different source code and error i get...
hope all master will help me to fix it

here is code
Code:
function GetTheProcessList()
local T = {}

  local SL=createStringlist()
  getProcesslist(SL)

   for i=0,strings_getCount(SL)-1 do
      T[i] = strings_getString(SL,i)
    end

  return T
end


function GetPros(sender)
  local PL = GetTheProcessList()
  local S = {}
  local variable = UDF1_CEComboBox1.text
  UDF1_CEListBox1.Clear()

  for x = 0, #PL do
        if variable == "All"
        then
         UDF1_CEListBox1.Items.Add(PL[x])
        else

           if string.sub(PL[x],10) == variable
            then
            --S[#S+1] = PL[x]  --list for reference
            UDF1_CEListBox1.Items.Add(PL[x])
            end

        end
     end


end
UDF1.Show()
UDF1_CEButton1Click = GetPros

function OpenPro()

  local a = UDF1_CEListBox1.ItemIndex

    if a ~= -1 -- negative 1 is nno selection
    then
     local b = string.sub(UDF1_CEListBox1.Items[a],0,8)
     b = tonumber(b,16)
     openProcess(b)
     showMessage('SUCCESS')
    else
    showMessage('SELECT PROCESS FIRST')
    end

end
UDF1.Show()
UDF1_CEButton2Click = OpenPro

UDF1_CEComboBox1.Text = "All"
UDF1_CEComboBox1.Items.Add('All')
UDF1_CEComboBox1.Items.Add('Firefox.exe')
UDF1_CEComboBox1.Items.Add('chrome.exe')
UDF1_CEComboBox1.Items.Add('opera.exe')
UDF1_CEComboBox1.Items.Add('notepad.exe')
UDF1_CEComboBox1.Items.Add('calc.exe')



processlist.png
 Description:
 Filesize:  92.14 KB
 Viewed:  4800 Time(s)

processlist.png




Last edited by vil33 on Tue Oct 06, 2020 2:11 am; edited 4 times in total
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Oct 05, 2020 11:05 pm    Post subject: Reply with quote

This is a simple way for process list. You can arrange this below script to your trainer script as yours needed.

Code:
function getAttachedProcessName()
    local m = enumModules();
    if (#m > 0) then
        local proname = m[1].Name
        local propid = getOpenedProcessID(m[1].Name)
        UDF1.CELabel1.Caption = 'Opened : '..propid..' - '..proname
        return m[1].Name
    end
    return nil;
end

function UDF1_CEButton1Click(sender)
 local pro = getMainForm().sbOpenProcess.doClick()
 local check = getAttachedProcessName()
  if check then
    getAttachedProcessName()
 else
    UDF1.CELabel1.Caption = 'Opened : '
    return nil
  end
end

UDF1.Show()

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Mon Oct 05, 2020 11:53 pm    Post subject: Reply with quote

finally it work master...
big thanks for all master
have a nice day master.... Very Happy


Last edited by vil33 on Tue Oct 06, 2020 2:28 am; edited 1 time in total
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Oct 06, 2020 2:14 am    Post subject: Reply with quote

Code:
function UDF1_CEButton2Click()

  local a = UDF1_CEListBox1.ItemIndex

    if a ~= -1 -- negative 1 is no selection then

     local b = string.sub(UDF1_CEListBox1.Items[a],0,8)
     b = tonumber(b,16)

     print(b)
    -- to check what the result of b and you can delete this line later.
     
    local pro = openProcess(b)

    if pro then
      showMessage('SUCCESS')
    else
      showMessage('SELECT PROCESS FIRST')
    end
 end
end

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Wed Oct 07, 2020 11:42 pm    Post subject: Reply with quote

Corroder wrote:
Code:
function UDF1_CEButton2Click()

  local a = UDF1_CEListBox1.ItemIndex

    if a ~= -1 -- negative 1 is no selection then

     local b = string.sub(UDF1_CEListBox1.Items[a],0,8)
     b = tonumber(b,16)

     print(b)
    -- to check what the result of b and you can delete this line later.
     
    local pro = openProcess(b)

    if pro then
      showMessage('SUCCESS')
    else
      showMessage('SELECT PROCESS FIRST')
    end
 end
end

master why the process name duplicate?
i don't why...

Code:
function GetTheProcessList()
local T = {}

  local SL=createStringlist()
  getProcesslist(SL)

   for i=0,strings_getCount(SL)-1 do
      T[i] = strings_getString(SL,i)
    end

  return T
end





function GetPros(sender)
  local PL = GetTheProcessList()
  local S = {}
  local variable = UDF1_CEComboBox1.text
  UDF1_CEListBox1.Clear()

  for x = 0, #PL do
        if variable == "All"
        then
         UDF1_CEListBox1.Items.Add(PL[x])
        else

           if string.sub(PL[x],10) == variable
            then
            S[#S+1] = PL[x]  --list for reference
            UDF1_CEListBox1.Items.Add(PL[x])
            end

        end
     end


end
UDF1.Show()
UDF1_CEButton1Click = GetPros


function OpenPro()

  local a = UDF1_CEListBox1.ItemIndex

    if a ~= -1 -- negative 1 is nno selection
    then
     local b = string.sub(UDF1_CEListBox1.Items[a],0,8)
     b = tonumber(b,16)
     openProcess(b)
     showMessage('SUCCESS')
    else
    showMessage('SELECT PROCESS FIRST')
    end

end
UDF1.Show()
UDF1_CEButton2Click = OpenPro


UDF1_CEComboBox1.Text = "All"
UDF1_CEComboBox1.Items.Add('All')
UDF1_CEComboBox1.Items.Add('PUBG.exe')
UDF1_CEComboBox1.Items.Add('chrome.exe')



duplicate_name.png
 Description:
 Filesize:  31.36 KB
 Viewed:  4747 Time(s)

duplicate_name.png


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

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Oct 08, 2020 2:40 am    Post subject: Reply with quote

Clear the table and list
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Thu Oct 08, 2020 6:28 am    Post subject: Reply with quote

how to clear it master? Confused
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Thu Oct 08, 2020 9:47 am    Post subject: Reply with quote

Code:
UDF1_CEListBox1.Clear() --Make sure you clear the list before adding it.
UDF1_CEComboBox1.Items.Add('opera.exe')
UDF1_CEComboBox1.Items.Add('notepad.exe')
UDF1_CEComboBox1.Items.Add('calc.exe')
UDF1_CEComboBox1.Items.Add('P-U-B-G-.-e-x-e')



NOTE;
Do not post online multiplayer games and examples of these games.
It may cause you to be alerted and / or lock the subject.
Sample; You can use "chrome.exe" or "game.exe".

atom0s wrote:
We do not allow online/multiplayer hacking on this site.


https
://
forum.cheatengine.
org/faq.php#0

EDIT: I gave the wrong example above. My fault.
Code:
UDF1.CEComboBox1.Clear()


Last edited by ByTransient on Thu Oct 08, 2020 11:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Thu Oct 08, 2020 10:06 pm    Post subject: Reply with quote

ByTransient wrote:
Code:
UDF1_CEListBox1.Clear() --Make sure you clear the list before adding it.
UDF1_CEComboBox1.Items.Add('opera.exe')
UDF1_CEComboBox1.Items.Add('notepad.exe')
UDF1_CEComboBox1.Items.Add('calc.exe')
UDF1_CEComboBox1.Items.Add('P-U-B-G-.-e-x-e')


NOTE;
Do not post online multiplayer games and examples of these games.
It may cause you to be alerted and / or lock the subject.
Sample; You can use "chrome.exe" or "game.exe".

atom0s wrote:
We do not allow online/multiplayer hacking on this site.


https
://
forum.cheatengine.
org/faq.php#0

i'm so sorry master i dont know...

code already added master but same

Code:
function GetPros(sender)
  local PL = GetTheProcessList() <-----
  local S = {}
  local variable = UDF1_CEComboBox1.text
  UDF1_CEListBox1.Clear() <-----
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Oct 08, 2020 11:27 pm    Post subject: Reply with quote

Run your game and then try open / attach the game process using CE default without any trainer. Check how many processes you found,

On attached image, I try open chrome process and as you can see there are more than one chrome process. So, that is chrome process by default.



Capture.JPG
 Description:
 Filesize:  91.7 KB
 Viewed:  4695 Time(s)

Capture.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Thu Oct 08, 2020 11:45 pm    Post subject: Reply with quote

Below is your code.
Look for "Cancellation" and "Added" notes.

Code:
function GetTheProcessList()
local T = {}
  local SL=createStringlist()
  getProcesslist(SL)

   for i=0,strings_getCount(SL)-1 do
      T[i] = strings_getString(SL,i)
    end
  return T
end

function GetPros(sender)
  local PL = GetTheProcessList()
  local S = {}
  local variable = UDF1_CEComboBox1.text
  UDF1_CEListBox1.Clear()

  for x = 0, #PL do
        if variable == "All"
        then
         UDF1_CEListBox1.Items.Add(PL[x])
        else

           if string.sub(PL[x],10) == variable
            then
            S[#S+1] = PL[x]  --list for reference
            UDF1_CEListBox1.Items.Add(PL[x])
            end
        end
     end
end

--UDF1.Show() --<<------Cancellation

--UDF1_CEButton1Click = GetPros --<<------Cancellation
UDF1.CEButton1.OnClick = GetPros --<<---- Added

function OpenPro()
  local a = UDF1_CEListBox1.ItemIndex
    if a ~= -1 -- negative 1 is nno selection
    then
     local b = string.sub(UDF1_CEListBox1.Items[a],0,8)
     b = tonumber(b,16)
     openProcess(b)
     showMessage('SUCCESS')
    else
    showMessage('SELECT PROCESS FIRST')
    end
end

--UDF1.Show() <<------ Cancellation

--UDF1_CEButton2Click = OpenPro  <<------ Cancellation
UDF1.CEButton2.OnClick = OpenPro --<<---- Added

--UDF1_CEComboBox1.Text = "All"  <<------ Cancellation

UDF1_CEComboBox1.Clear() --<<---- Added
UDF1_CEComboBox1.Items.Add('Process Select') --<<---- Added
UDF1_CEComboBox1.Items.Add('All')
UDF1_CEComboBox1.Items.Add('GAME.exe')
UDF1_CEComboBox1.Items.Add('chrome.exe')
UDF1.CEComboBox1.ItemIndex="0" --<<---- Added --or index 1 = All

UDF1.Show() --<<------ Added


Last edited by ByTransient on Fri Oct 09, 2020 12:19 am; edited 1 time in total
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Oct 08, 2020 11:58 pm    Post subject: Reply with quote

Whose code?
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Fri Oct 09, 2020 12:02 am    Post subject: Reply with quote

vil33 wrote:

Code:
function GetTheProcessList()
local T = {}

  local SL=createStringlist()
  getProcesslist(SL)

   for i=0,strings_getCount(SL)-1 do
      T[i] = strings_getString(SL,i)
    end

  return T
end





function GetPros(sender)
  local PL = GetTheProcessList()
  local S = {}
  local variable = UDF1_CEComboBox1.text
  UDF1_CEListBox1.Clear()

  for x = 0, #PL do
        if variable == "All"
        then
         UDF1_CEListBox1.Items.Add(PL[x])
        else

           if string.sub(PL[x],10) == variable
            then
            S[#S+1] = PL[x]  --list for reference
            UDF1_CEListBox1.Items.Add(PL[x])
            end

        end
     end


end
UDF1.Show()
UDF1_CEButton1Click = GetPros


function OpenPro()

  local a = UDF1_CEListBox1.ItemIndex

    if a ~= -1 -- negative 1 is nno selection
    then
     local b = string.sub(UDF1_CEListBox1.Items[a],0,8)
     b = tonumber(b,16)
     openProcess(b)
     showMessage('SUCCESS')
    else
    showMessage('SELECT PROCESS FIRST')
    end

end
UDF1.Show()
UDF1_CEButton2Click = OpenPro


UDF1_CEComboBox1.Text = "All"
UDF1_CEComboBox1.Items.Add('All')
UDF1_CEComboBox1.Items.Add('PUBG.exe')
UDF1_CEComboBox1.Items.Add('chrome.exe')
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
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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