|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
gavrielsinvani Cheater Reputation: 0
Joined: 29 May 2019 Posts: 32
|
Posted: Wed Jul 05, 2023 6:19 pm Post subject: I want a list of a specific process |
|
|
I use the following code,
But it gives me a list of all the processes.
I want it to give me a list only for the "chrome.exe" process
anyone can help me fix the code please?
Code: | f = createForm()
control_setSize(f, 400,400)
control_setCaption(f, "Process List")
setProperty(f , "BiDiMode", "bdLeftToRight")
list = createListBox(f)
x,y = control_getSize(f)
control_setSize(list, x-10, y-30)
control_setPosition(list, 5,5)
button1 = createButton(f)
button2 = createButton(f)
button3 = createButton(f)
control_setSize(button1, 80, 20)
control_setSize(button2, 80, 20)
control_setSize(button3, 80, 20)
control_setCaption(button1, "Get Processes")
control_setCaption(button2, "Clear")
control_setCaption(button3, "Attach")
control_setPosition(button1, 50,y-22)
control_setPosition(button2, 150,y-22)
control_setPosition(button3, 250,y-22)
Items = listbox_getItems(list)
TempTable = {}
function GetTheProcessList()
local SL=createStringlist()
getProcesslist(SL)
for i=0,strings_getCount(SL)-1 do
local entry = strings_getString(SL,i)
local processname = entry:sub(10,255)
local PID = tonumber('0x'..entry:sub(1,8))
TempTable[i] = {PID, processname}
end
return TempTable
end
function AddTheProcessList()
GetTheProcessList()
index = 0
for y in pairs (TempTable) do
index = index+1
end
for i=0, index-1 do
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
strings_add(Items, TempText)
end
end
end
function GetAndAddProcess()
TempTable = {}
strings_clear(Items)
AddTheProcessList()
end
function Clear()
TempTable = {}
strings_clear(Items)
end
function AttachToTheSelectedProcess()
local ProcessID = listbox_getItemIndex(list)
if ProcessID~=-1 then
if TempTable[ProcessID][1]~=nil then
openProcess(TempTable[ProcessID][1])
else
return showMessage("Failed to open the select process")
end
else
return showMessage("Please choose a process from the list")
end
end
control_onClick(button1,GetAndAddProcess)
control_onClick(button2,Clear)
control_onClick(button3,AttachToTheSelectedProcess) |
I guess that's the part to change:
Code: | function AddTheProcessList()
GetTheProcessList()
index = 0
for y in pairs (TempTable) do
index = index+1
end
for i=0, index-1 do
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
strings_add(Items, TempText)
end
end
end |
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1261
|
Posted: Thu Jul 06, 2023 2:43 am Post subject: |
|
|
Try this edited script. The added code will give you an idea.
Added a box and button to filter.
If the box is empty, it will print all processes.
Ahh.. I didn't get a chance to test this, could you please test it for me.
Code: |
f = createForm()
f.Height=430
f.Width=400
control_setCaption(f, "Process List")
setProperty(f , "BiDiMode", "bdLeftToRight")
list = createListBox(f)
x,y = control_getSize(f)
control_setSize(list, x-10, y-30)
control_setPosition(list, 5,5)
button1 = createButton(f)
button2 = createButton(f)
button3 = createButton(f)
control_setSize(button1, 80, 20)
control_setSize(button2, 80, 20)
control_setSize(button3, 80, 20)
control_setCaption(button1, "Get Processes")
control_setCaption(button2, "Clear")
control_setCaption(button3, "Attach")
control_setPosition(button1, 50,y-50)
control_setPosition(button2, 150,y-50)
control_setPosition(button3, 250,y-50)
button4 = createButton(f)
control_setSize(button4, 80, 20)
control_setCaption(button4, "Filter")
control_setPosition(button4, 160,y-22)
edit1 = createEdit(f)
edit1.Width=100
edit1.left=50 edit1.top= y-22
edit1.Text = "chrome.exe"
Items = listbox_getItems(list)
TempTable = {}
function GetTheProcessList()
local SL=createStringlist()
getProcesslist(SL)
for i=0,strings_getCount(SL)-1 do
local entry = strings_getString(SL,i)
local processname = entry:sub(10,255)
local PID = tonumber('0x'..entry:sub(1,8))
TempTable[i] = {PID, processname}
end
return TempTable
end
function AddTheProcessList()
GetTheProcessList()
index = 0
for y in pairs (TempTable) do
index = index+1
end
for i=0, index-1 do
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
strings_add(Items, TempText)
end
end
end
function GetAndAddProcess()
TempTable = {}
strings_clear(Items)
AddTheProcessList()
end
function Clear()
TempTable = {}
strings_clear(Items)
end
function AttachToTheSelectedProcess()
local ProcessID = listbox_getItemIndex(list)
if ProcessID~=-1 then
if TempTable[ProcessID][1]~=nil then
openProcess(TempTable[ProcessID][1])
else
return showMessage("Failed to open the select process")
end
else
return showMessage("Please choose a process from the list")
end
end
function filterProcess()
-- for i,k in pairs (TempTable) do
-- TempTable[i][1]=nil
-- TempTable[i][2]=nil
-- end
TempTable = {}
strings_clear(Items)
GetTheProcessList()
index = 0
for y in pairs (TempTable) do
index = index+1
end
for i=0, index-1 do
if edit1.text~="" then
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
if TempTable[i][2]==edit1.Text then
strings_add(Items, TempText)
end
end
else
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
strings_add(Items, TempText)
end
end
end
end
control_onClick(button1,GetAndAddProcess)
control_onClick(button2,Clear)
control_onClick(button3,AttachToTheSelectedProcess)
control_onClick(button4,filterProcess)
|
_________________
|
|
Back to top |
|
|
gavrielsinvani Cheater Reputation: 0
Joined: 29 May 2019 Posts: 32
|
Posted: Thu Jul 06, 2023 4:47 am Post subject: |
|
|
AylinCE wrote: | Try this edited script. The added code will give you an idea.
Added a box and button to filter.
If the box is empty, it will print all processes.
Ahh.. I didn't get a chance to test this, could you please test it for me.
Code: |
f = createForm()
f.Height=430
f.Width=400
control_setCaption(f, "Process List")
setProperty(f , "BiDiMode", "bdLeftToRight")
list = createListBox(f)
x,y = control_getSize(f)
control_setSize(list, x-10, y-30)
control_setPosition(list, 5,5)
button1 = createButton(f)
button2 = createButton(f)
button3 = createButton(f)
control_setSize(button1, 80, 20)
control_setSize(button2, 80, 20)
control_setSize(button3, 80, 20)
control_setCaption(button1, "Get Processes")
control_setCaption(button2, "Clear")
control_setCaption(button3, "Attach")
control_setPosition(button1, 50,y-50)
control_setPosition(button2, 150,y-50)
control_setPosition(button3, 250,y-50)
button4 = createButton(f)
control_setSize(button4, 80, 20)
control_setCaption(button4, "Filter")
control_setPosition(button4, 160,y-22)
edit1 = createEdit(f)
edit1.Width=100
edit1.left=50 edit1.top= y-22
edit1.Text = "chrome.exe"
Items = listbox_getItems(list)
TempTable = {}
function GetTheProcessList()
local SL=createStringlist()
getProcesslist(SL)
for i=0,strings_getCount(SL)-1 do
local entry = strings_getString(SL,i)
local processname = entry:sub(10,255)
local PID = tonumber('0x'..entry:sub(1,8))
TempTable[i] = {PID, processname}
end
return TempTable
end
function AddTheProcessList()
GetTheProcessList()
index = 0
for y in pairs (TempTable) do
index = index+1
end
for i=0, index-1 do
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
strings_add(Items, TempText)
end
end
end
function GetAndAddProcess()
TempTable = {}
strings_clear(Items)
AddTheProcessList()
end
function Clear()
TempTable = {}
strings_clear(Items)
end
function AttachToTheSelectedProcess()
local ProcessID = listbox_getItemIndex(list)
if ProcessID~=-1 then
if TempTable[ProcessID][1]~=nil then
openProcess(TempTable[ProcessID][1])
else
return showMessage("Failed to open the select process")
end
else
return showMessage("Please choose a process from the list")
end
end
function filterProcess()
-- for i,k in pairs (TempTable) do
-- TempTable[i][1]=nil
-- TempTable[i][2]=nil
-- end
TempTable = {}
strings_clear(Items)
GetTheProcessList()
index = 0
for y in pairs (TempTable) do
index = index+1
end
for i=0, index-1 do
if edit1.text~="" then
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
if TempTable[i][2]==edit1.Text then
strings_add(Items, TempText)
end
end
else
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
strings_add(Items, TempText)
end
end
end
end
control_onClick(button1,GetAndAddProcess)
control_onClick(button2,Clear)
control_onClick(button3,AttachToTheSelectedProcess)
control_onClick(button4,filterProcess)
|
|
working great thanks ♥
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1261
|
Posted: Thu Jul 06, 2023 5:20 am Post subject: |
|
|
Here is the next problem:
"There is more than one 'chrome.exe' in the process list.
How can I find the right process?
Solution;
Probably your game will be in the process that uses the most memory in Chrome (otherwise you can see it in a certain memory range all the time), and for this you need a listing method that will also show you the memory used by the "chrome.exe" processes.
I recommend using the solution below.
https://forum.cheatengine.org/viewtopic.php?p=5784781#5784781
_________________
|
|
Back to top |
|
|
gavrielsinvani Cheater Reputation: 0
Joined: 29 May 2019 Posts: 32
|
Posted: Thu Jul 06, 2023 7:13 am Post subject: |
|
|
AylinCE wrote: | Here is the next problem:
"There is more than one 'chrome.exe' in the process list.
How can I find the right process?
Solution;
Probably your game will be in the process that uses the most memory in Chrome (otherwise you can see it in a certain memory range all the time), and for this you need a listing method that will also show you the memory used by the "chrome.exe" processes.
I recommend using the solution below.
https://forum.cheatengine.org/viewtopic.php?p=5784781#5784781 |
Your code is fine, it's not for chrome.exe, it was just an example.
But I have another problem.
The specific process "Game.exe",
Only he appears in my list, exactly as I wanted
but...
When I click attach, it actually does Attach to the original index from the full list,
It actually does not select the correct index :/
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1261
|
Posted: Thu Jul 06, 2023 1:18 pm Post subject: |
|
|
Code: | f = createForm()
f.Height=430
f.Width=400
control_setCaption(f, "Process List")
setProperty(f , "BiDiMode", "bdLeftToRight")
list = createListBox(f)
x,y = control_getSize(f)
control_setSize(list, x-10, y-60)
control_setPosition(list, 5,5)
button1 = createButton(f)
button2 = createButton(f)
button3 = createButton(f)
control_setSize(button1, 80, 20)
control_setSize(button2, 80, 20)
control_setSize(button3, 80, 20)
control_setCaption(button1, "Get Processes")
control_setCaption(button2, "Clear")
control_setCaption(button3, "Attach")
control_setPosition(button1, 50,y-50)
control_setPosition(button2, 150,y-50)
control_setPosition(button3, 250,y-50)
button4 = createButton(f)
control_setSize(button4, 80, 25)
control_setCaption(button4, "Filter")
control_setPosition(button4, 160,y-25)
edit1 = createEdit(f)
edit1.Width=100
edit1.left=50 edit1.top= y-25
edit1.Text = "chrome.exe"
Items = listbox_getItems(list)
TempTable = {}
pidTable = {}
function GetTheProcessList()
local SL=createStringlist()
getProcesslist(SL)
for i=0,strings_getCount(SL)-1 do
local entry = strings_getString(SL,i)
local processname = entry:sub(10,255)
local PID = tonumber('0x'..entry:sub(1,8))
TempTable[i] = {PID, processname}
end
return TempTable
end
function AddTheProcessList()
GetTheProcessList()
index = 0
for y in pairs (TempTable) do
index = index+1
end
for i=0, index-1 do
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
strings_add(Items, TempText)
end
end
end
function GetAndAddProcess()
TempTable = {}
pidTable = {}
strings_clear(Items)
AddTheProcessList()
end
function Clear()
TempTable = {}
pidTable = {}
strings_clear(Items)
end
function AttachToTheSelectedProcess()
local a1 = list.ItemIndex
local pro1 = list.Items
local ProcessID = pidTable[tonumber(a1) + 1]
if ProcessID~=nil then
openProcess(tonumber(ProcessID))
print(ProcessID)
if getOpenedProcessID()~=tonumber(ProcessID) then
return showMessage("Failed to open the select process")
end
else
return showMessage("Please choose a process from the list")
end
end
function filterProcess()
for i,k in pairs (pidTable) do
pidTable[i]=nil
end
TempTable = {}
strings_clear(Items)
GetTheProcessList()
index = 0
for y in pairs (TempTable) do
index = index+1
end
for i=0, index-1 do
if edit1.text~="" then
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
if TempTable[i][2]==edit1.Text then
pidTable[#pidTable + 1]=TempTable[i][1]
strings_add(Items, TempText)
end
end
else
if TempTable[i]~='' and TempTable[i]~= nil then
local TempText = "Process ID : "..TempTable[i][1].." Process Name : "..TempTable[i][2]
strings_add(Items, TempText)
end
end
end
end
control_onClick(button1,GetAndAddProcess)
control_onClick(button2,Clear)
control_onClick(button3,AttachToTheSelectedProcess)
control_onClick(button4,filterProcess)
|
_________________
|
|
Back to top |
|
|
|
|
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
|
|