Asset - Extension Process Information (for Windows, macOS, and Ubuntu)

Samuel Venable

Time Killer

The macOS dylib file is not code signed; please code sign it before testing and distributing for macOS.

Process Information

Allows executing, reading, and manipulating various information from application processes.

The library's source code can also be easily used in your C++ projects, (which is how I included a BSD build screenshot).

  • process_t - process identifier (real) - on Windows, this is a typedef of a DWORD (unsigned long), and on Mac/Linux it is a pid_t (signed long). Safely casted to a double for GameMaker extension compatibility.

  • window_t - window handle (pointer) - HWND (void *) on Windows, NSWindow * (void *) on Mac, and Window (unsigned long) on Linux. Casted to a void * for generic, cross-platform compatibility, using the same header.

  • wid_t - window identifier (string) - a std::string (basic_string<char>) wrapping a window id number in quotes for use in various interpreted scripting languages like VBScript on Windows or AppleScript on Mac, or shell programs like Zenity on Linux. On Windows, this number is a std::to_string((unsigned long long)HWND), on Mac, this is a std::to_string((unsigned long)CGWindowID), and on Linux is is a std::to_string((unsigned long)Window). This string can be used to represent the shell scripting equivalent for a global window handle.

// Execute process, returns process id
process_t process_execute(string command);

// Execute process outside main thread
void process_execute_async(string command);

// Return previous executed process id
process_t process_previous();

// Evaluate last process output string
string process_evaluate();

// Clears previous process id executed
void process_clear_pid();

// Clears previous process output text
void process_clear_out();

// Get process id from current process
process_t pid_from_self();

// Parent process id from this process
process_t ppid_from_self();

// Get executable path from process id
string path_from_pid(process_t pid);

// Get exe parent path from process id
string dir_from_pid(process_t pid);

// Get executable name from process id
string name_from_pid(process_t pid);

// Return command line from process id
string cmd_from_pid(process_t pid);

// Return environ vars from process id
string env_from_pid(process_t pid);

// Check for existence from process id
bool pid_exists(process_t pid);

// Check existence for given window id
bool wid_exists(wid_t wid);

// Kill an application from process id
bool pid_kill(process_t pid);

// Return window handle from window id
window_t window_from_wid(wid_t wid);

// Return window id from window handle
wid_t wid_from_window(window_t window);

// Get owner process id from window id
process_t pid_from_wid(wid_t wid);

// Return strings for every process id
string pids_enum(bool trim_dir, bool trim_empty);

// Get parent process id of process id
process_t ppid_from_pid(process_t pid);

// Get list of process ids from parent
string pids_from_ppid(process_t ppid);

// Get list of window ids from process
string wids_from_pid(process_t pid);

// Get window id from frontmost window
wid_t wid_from_top();

// Get process id from topmost process
process_t pid_from_top();

// Bring window id to frontmost window
void wid_to_top(wid_t wid);

// Add a parent window id to window id
void wid_set_pwid(wid_t wid, wid_t pwid);

// Return output of a given expression
string echo(string expression);
Marketplace Page:
Last edited:

Samuel Venable

Time Killer
lol I can't help but notice that this is basically just like my most popular asset on the marketplace, Execute Shell, but on steroids. Execute Shell has thousands of downloads, and a crap ton of 5/5 reviews. I wonder why this asset, which capable of all the same things, and a lot more than that, hasn't really gotten any traction yet? Does anyone actually know what this extension even does? Am I not describing it properly? Or am I just overthinking it with my impatience?

Samuel Venable

Time Killer

Free GameMaker Video Player Example for Linux, (uses Process Information Extension + MPV Media Player).

Download Free:

I will be adding this example to the marketplace in the near future. Note mpv media player may be GPL but because you are not linking with it nor are you using its source compiled directly into your exe it is fine to distribute your game closed-source using this and since GPL is officially bypassed when used in an binary executable format separate from your game, all the extension does is execute the program with command line parameters which is not linking at all. It requires you and the end user to have the video player installed via your package manager or however:
sudo apt-get install mpv
Last edited:

Samuel Venable

Time Killer
@Unknown Entity I fixed this extension if you ever happen to need it. It should no longer hang for you. If you are ok with updating and trying it again that would be great so other people will be able to see you verified it works now.


This can be used to execute batch files? I'm having a tough time getting it to do what I'm trying. Essentially I'm saving a surface to a png then trying to use this to convert it to another format using a bat file with the proper instructions.

var dir = working_directory+"\Assets\\Dependencies\\ConvertStepA.bat";
dir = @'"'+dir+@'"';
I've placed quotes around the directory but it doesn't launch the bat, even if I use get_open_filename to track down the file I want to launch manually it still fails to do anything.

Samuel Venable

Time Killer
var dir = working_directory+"\Assets\\Dependencies\\ConvertStepA.bat";
dir = "cmd /c " + @'"'+dir+@'"';

Should do the trick. :)


I'll give that a shot when I get home, thanks!

EDIT: Still getting no results. It's like it can't find the file or something.
Last edited:

Samuel Venable

Time Killer
Is anyone else able to reproduce this problem with batch files not working, even when attempted the way I mentioned? I'm still waiting to hear back from @IGameArt with a private conversation we're having regarding the issue, and if I could debug it and find the source of the problem sooner, it would help him and potenially others.


Just noticed a problem with the code provided.
var dir = working_directory+"\Assets\\Dependencies\\ConvertStepA.bat";
dir = @'"'+dir+@'"';
There is an unnecessary backslash that bwoke it. It should be:

var dir = working_directory+"Assets\\Dependencies\\ConvertStepA.bat";
dir = @'"'+dir+@'"';
Last edited:

Samuel Venable

Time Killer
Updated the example project file to cover more functionality out of the box.

The project is now basically a "Linux process filesystem simulator" which demonstrates how to get various information from a Linux process id via the process filesystem. When the project is run on Linux, you are literally making use of the process filesystem. However, on Windows and Mac, there is no real process filesystem, so the project merely imitates that same basic concept, for the sake of being cross-platform / easy to follow.

The process filesystem structure can be summarized as follows:

is an existing process id, which may be retrieved from the pids_enum(trim_dir, trim_empty) function.
<file> can be "exe", (without the quotes), resolving the symlink, to the executable file of the given <pid>.
<file> can be "cmdline", (without the quotes), reading the command line parameters of the given <pid>.
<file> can be "environ", (without the quotes), reading the environment variables of the given <pid>.

pids_enum(trim_dir, trim_empty) may be parsed by passing its return value to @YellowAfterlife's string_split(string, delimiter) function.
PID        PPID     NAME
0          0        (process swapper)
1          0        init.exe
666        1        virus.exe
777        1        WindowsDefender.exe
pids_enum(trim_dir, trim_empty) will return the pid, ppid, and name, (or path), of every application process instance currently running on your machine. The example output of the function above is just a joke, but it gets the general idea across of how to parse it. Split the string by each new line, (or \n), to separate each process id, (or PID), to be grouped together with it's parent process id, (or PPID), and NAME, (or PATH, if trim_dir was false), while skipping the first line, that is just there for labeling purposes if you where wanted to have a label above the 3 columns when drawing the return value with draw_text(x, y, text). Then each new line, (or \n), should be split by tab characters (or \t). Note that trim_empty removes all process id rows that correspond with a NAME or PATH which cannot be retrieved due to the security attributes of the process.

New Screenshots:

Last edited: