Skip to content

Shell Execute

Grisgram edited this page Aug 7, 2025 · 6 revisions

Sometimes, you want to execute a shell command from your game, like opening a URL in the browser or any other web site (maybe a feedback form, bug reports, something like that).

In a more sophisticated game you might even want to execute some scripts or utility programs to patch your game files. Whatever the need is, when you need to communicate with the OS, things can get complicated, especially from within a game engine like GameMaker. While it supports opening of a URL, it does not support executing other things.

shell_run
shell_run_wait

For these scenarios, raptor comes with a slightly modified version of execute_shell_simple by YellowAfterLife. This extension allows you (Windows only!) to execute any command on the windows shell.

Raptor modified it a bit an gave it a more intuitive and simpler interface (you shall not have to deal with Microsoft's MSDN page and read through C++ constant declarations just run a batch script), and offers you two easy-to-use functions to execute something in the operating system.

shell_run

/// @func	shell_run(_commandline, _hidden = true)
/// @desc	Executes a shell command or starts a program, optionally hidden
///		NOTE: This call does NOT wait until the program is finished!
///		To sync with execution end, use shell_run_wait(...).
function shell_run(_commandline, _hidden = true) {

shell_run_wait

/// @func	shell_run_wait(_commandline, _finished_callback = undefined)
/// @desc	Executs a command line and waits until it is finished.
///		NOTE: Due to the nature of a temp batch file created to allow this, you can not
///		run this hidden (the temp batch is executed hidden, though, but not your
///		command unless it is just a shell command).
///		The finished callback is invoked when the task is finished.
///		NOTE: In contrast to shell_run, you supply the fully qualified commandline
///		to this function, with arguments and all. It is inserted into the batch file
///		1:1.
function shell_run_wait(_commandline, _finished_callback = undefined) {

Getting started

Raptor Tools (Work in Progress)

Raptor Free Modules

Image Raptor Pro Modules

Image Raptor Pro Libraries

Clone this wiki locally