Page 1 of 3
Detect Operating System
Posted: Wed Dec 18, 2013 10:02 am
by tegwin
Hello,
I am looking to develop an app that will do something based on what system its runing on .. ie. if this is a Windows machine do this, or if Mac do soemthing else.. ALso like this can be installed on a Android but not iphone
Re: Detect Operating System
Posted: Wed Dec 18, 2013 10:06 am
by Dixie
read 'SystemVersion' in the dictionary....
Re: Detect Operating System
Posted: Wed Dec 18, 2013 10:42 am
by tegwin
Ok thanks.. does not really help as I dont know how to write code for it
thanks
Re: Detect Operating System
Posted: Wed Dec 18, 2013 11:03 am
by Dixie
for example...
Code: Select all
on openCard
put the systemVersion into temp
if temp = "10.9.0" then
answer "This Mac is running 'Mavericks'"
end if
end openCard
Re: Detect Operating System
Posted: Wed Dec 18, 2013 3:59 pm
by FourthWorld
The systemVersion will tell you the OS version number. To know which platform your app is running on see the platform function, e.g.:
Code: Select all
switch the platform
case "MacOS"
DoMacStuff
break
case "Win32"
DoWinStuff
break
case "Linux"
DoLinuxStuff
break
end switch
Ok thanks.. does not really help as I dont know how to write code for it
Sometimes the folks who help here in the forums will have the spare time to write example code for you, but many times they'll just help you identify the tokens needed - at that point you'll want to use the Dictionary included in LiveCode to learn about how the token works, see examples of its usage, and review the related "See Also" items.
Re: Detect Operating System
Posted: Wed Apr 22, 2020 7:56 am
by richmond62
"Win32" on any version of Windows
"Linux" on all Linux distributions
"MacOS" on any version of Mac OS X
"iphone" on iPhones, iPads and other iOS devices
"android" on smartphones, tablets and other Android devices
"HTML5" when running in a web browser
Well, Yes, But . . .
How does one differentiate between 32-bit and 64-bit variants of Windows?
How does one differentiate between 32-bit and 64-bit variants of Linux?
How does one differentiate between 32-bit and 64-bit variants of MacOS? [and before anyone makes a noise,
a pre-10.15 MacOS version while being 64-bit can run a 32-bit program].
MacOS 10.7.5 < 32 or 64-bit apps < MacOS 10.15.0
How does one detect that one is running a Windows standalone on WINE?
How does one detect ReactOS? [OK, OK, OK; I just bunged this one in to be snotty].
Re: Detect Operating System
Posted: Wed Apr 22, 2020 11:11 am
by FourthWorld
To distinguish processors use the processors function.
Re: Detect Operating System
Posted: Wed Apr 22, 2020 11:22 am
by bogs
I guess neither of you remember the thread that Richmond already brought this up in, where it was discovered that no variation of commands in Lc will tell you any of that, short of dropping to the shell (if available).
Re: Detect Operating System
Posted: Wed Apr 22, 2020 4:04 pm
by FourthWorld
I remember it well. I was as surprised as you were that this thread was necromanced with a question so thoroughly addressed so much more recently.
Re: Detect Operating System
Posted: Wed Apr 22, 2020 5:53 pm
by richmond62
so thoroughly addressed so much more recently
Is that a fact?
Re: Detect Operating System
Posted: Wed Apr 22, 2020 6:36 pm
by FourthWorld
richmond62 wrote: ↑Wed Apr 22, 2020 5:53 pm
so thoroughly addressed so much more recently
Is that a fact?
Why do you imagine I might have both time and interest to mislead you in a way that would be so easily disproven with a quick search?
Re: Detect Operating System
Posted: Wed Apr 22, 2020 6:42 pm
by FourthWorld
A search for "systemVersion" shows this thread as the first result, a conversation from Feb 21 through March 3, covering nearly every aspect of system profiling information included in LC, and many using external tools:
https://forums.livecode.com/viewtopic.php?f=6&t=33707
With a quick skim it looks like you posted half a dozen contributions to that four-page thread.
Re: Detect Operating System
Posted: Wed Apr 22, 2020 7:30 pm
by bogs
Well, it was only 4 pages after all

Re: Detect Operating System
Posted: Thu Apr 23, 2020 1:18 pm
by richmond62
I would not just suppose anyone on this list would want to mislead me: the word I took issue
with was "thoroughly" which is a highly subjective term.
Re: Detect Operating System
Posted: Thu Apr 23, 2020 2:18 pm
by bogs
On the other side of that, the answer(s) given were pretty definitive, your not going to get that information from Lc, and the reasons why. You can, in desktop cases anyway, get the information by directly interrogating the OS, Lc just isn't going to build in a way to get it through the language.