Skip to content

Instantly share code, notes, and snippets.

@Paratron
Last active October 31, 2021 11:25
Show Gist options
  • Save Paratron/366fb58dd6ce9f142867f5e8850adaa4 to your computer and use it in GitHub Desktop.
Save Paratron/366fb58dd6ce9f142867f5e8850adaa4 to your computer and use it in GitHub Desktop.
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