Description: Open a URL or file in the default web browser of currently logged in user
GM Version: GM5+
Registered: No
Required Extension: No
Required DLL: No
Tags: web, browser, default, open, page, url, file
Note: Only works on windows, not sure about GM5 but should work on all others newer than 5
This is a script I wrote, it will open a given URL/file in the default web browser of the user on the computer, even if the default web browser changes while the game/program is running.
Script is
if (string(argument0) != "") { //Check for a string input
var browserDir, browser;
registry_set_root(0); //Set the registry root to that of LOCAL USER
browser = registry_read_string_ext("\Software\Clients\StartMenuInternet", ""); //Read the name of the default browser
registry_set_root(1); //Set the registry root to that of the system, which will have the file location of the default browsers executable
browserDir = registry_read_string_ext("\Software\Clients\StartMenuInternet\" + browser + "\shell\open\command", ""); //Read the directory of the default browser
browserDir = string_copy(browserDir, 2, string_length(browserDir) - 2); //Remove the quotes that will be in the string, from the registry
execute_program(browserDir, argument0, 0); //Execute the browser with the URL/file given
}
If you pass a real value or an empty string, or just simply nothing, this script will do nothing. For those who may ask, this will open a new tab if the browser is already open.
This could be really useful if you have a system to check your game for updates and want to direct your players to a download page, or if you simply want a button to send players to your website. This script will make no changes to the registry, only read it.



Find content
Male


