Skip to content

Instantly share code, notes, and snippets.

@Paratron
Last active Oct 31, 2021
Embed
What would you like to do?
A script to open a website from within visionaire
-- Use this script to open a website.
-- Call the function like this:
-- openWebsite("https://example.com")
-- ------------------------------------------------------------
-- Helper function to detect the system type.
-- Returns either "win", "mac" or "linux"
function getOS()
local os = string.lower(system.systemInfo().os);
if string.match(os, "win") then
return "win";
end
if string.match(os, "mac") then
return "mac";
end
return "linux";
end
function openWebsite(url)
if getOS() == "win" then
os.execute("start " .. url);
return;
end
if getOS() == "mac" then
os.execute("open " .. url);
return;
end
os.execute("xdg-open " .. url);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment