Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
LiveCode code that generates a UUID on OS X, Linux and Windows.
function generateUUID
local theError, theUUID
switch the platform
case "macos"
case "linux"
put shell("uuidgen") into theUUID
put word 1 to -1 of theUUID into theUUID
put the result into theError
case "win32"
put format("set TypeLib = CreateObject(\"Scriptlet.TypeLib\")") into theVBScript
put cr & "result = TypeLib.Guid" after theVBScript
do theVBScript as "vbscript"
put the result into theresult
put word 1 to -1 of theresult into theressult
if theresult begins with "{" then
put char 2 to -2 of theresult into theUUID
end if
end switch
if theError is empty then
return theUUID
return empty
end if
end generateUUID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.