Difference between revisions of "Lua:openProcess"

From Cheat Engine
Jump to navigation Jump to search
m
m (Syntax Highlighting.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' openProcess(''ProcessID'')
+
{{CodeBox|'''function''' openProcess(''ProcessID'')}}
'''function''' openProcess(''ProcessName'')
+
{{CodeBox|'''function''' openProcess(''ProcessName'')}}
  
 
Opens the specified process in Cheat Engine, either by process ID or by process name.   
 
Opens the specified process in Cheat Engine, either by process ID or by process name.   
Line 22: Line 22:
  
 
===Examples===
 
===Examples===
<pre>
+
<syntaxhighlight lang="lua" line>
 
-- Open a process by name
 
-- Open a process by name
 
openProcess("notepad.exe")
 
openProcess("notepad.exe")
Line 31: Line 31:
 
   openProcess(pid)
 
   openProcess(pid)
 
end
 
end
</pre>
+
</syntaxhighlight>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}
  
=== Related Functions ===
+
{{Process}}
* [[Lua:getProcesslist|getProcesslist]]
 
* [[Lua:getOpenedProcessID|getOpenedProcessID]]
 
* [[Lua:getProcessIDFromProcessName|getProcessIDFromProcessName]]
 
* [[Lua:createProcess|createProcess]]
 
* [[Lua:openFileAsProcess|openFileAsProcess]]
 

Latest revision as of 19:08, 25 June 2026

<> Lua API Reference

function openProcess(ProcessID)

<> Lua API Reference

function openProcess(ProcessName)

Opens the specified process in Cheat Engine, either by process ID or by process name. This sets the target process for memory editing and scanning.

Function Parameters[edit]

Parameter Type Description
ProcessID Integer The ID of the process to open.
ProcessName String The name of the process to find and open (e.g., "notepad.exe").

Examples[edit]

1 -- Open a process by name
2 openProcess("notepad.exe")
3 
4 -- Open a process by ID
5 local pid = getProcessIDFromProcessName("notepad.exe")
6 if pid then
7   openProcess(pid)
8 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Process Open / Creation

Process Lists / Modules

Process Control / Target State