Last active
October 31, 2021 11:25
-
-
Save Paratron/366fb58dd6ce9f142867f5e8850adaa4 to your computer and use it in GitHub Desktop.
A script to open a website from within visionaire
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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