Detection of current version 'Windows' Operating system using Studio 5 -- sys(7) alternative
Paul Mulroney
pmulroney at logicaldevelopments.com.au
Mon Nov 5 19:57:04 EST 2018
Hi Doug,
Here's the bit of code we use for Studio 5:
; - Display platform details in a meaningful fashion
Calculate vsPlatform as pick(pos(sys(6),'WNMXU'),'','Win98','Win32','Mac OS9','Mac OSX','Linux')
If islion() ;; Put the most recent Mac OS first
Calculate vsOS as '10.7 (Lion)'
Else If issnowleopard()
Calculate vsOS as '10.6 (Snow Leopard)'
Else If isleopard()
Calculate vsOS as '10.5 (Leopard)'
Else If iswindows7(kFalse) ;; Put the most recent Windows OS first
If iswindows7(kTrue) ;; Themed
Calculate vsOS as 'Windows 7 (Themed)'
Else
Calculate vsOS as 'Windows 7'
End If
Else If isvista(kFalse)
If isvista(kTrue) ;; Themed
Calculate vsOS as 'Windows Vista (Themed)'
Else
Calculate vsOS as 'Windows Vista'
End If
Else If sys(6)='N'&sys(197)=kTrue ;; Windows XP with themes enabled.
Else ;; Not any of the above, probably no further information available
Calculate vsOS as 'No further details'
End If
For Studio 8, there's a few more options, but some of this will probably still work for Studio 5:
; --- Get the windows version details
Calculate vsOS as sys(7)
Calculate vnPartOne as strtok('vsOS','.')
Calculate vnPartTwo as strtok('vsOS','.')
; -- Check Windows Server
If iswindowsserver()
If vnPartOne=10 ;; Server NT 10.x
If vnPartTwo=0 ;; Win Server 2016 -> Server NT 10.0
Calculate psOS as 'Windows Server 2016'
Else
Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
End If
Else If vnPartOne=6 ;; Server NT 6.x
If vnPartTwo=3 ;; Win Server 2012 R2 -> Server NT 6.3
Calculate psOS as 'Windows Server 2012 R2'
Else If vnPartTwo=2 ;; Win Server 2012 -> Server NT 6.2
Calculate psOS as 'Windows Server 2012'
Else If vnPartTwo=1 ;; Win Server 2008 R2 -> Server NT 6.1
Calculate psOS as 'Windows Server 2008 R2'
Else If vnPartTwo=0 ;; Win Server 2008 -> Server NT 6.0
Calculate psOS as 'Windows Server 2008'
Else
Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
End If
Else If vnPartOne=5 ;; Server NT 5.x
If vnPartTwo=2 ;; Win Server 2003 -> Server NT 5.2
Calculate psOS as 'Windows Server 2003'
Else If vnPartTwo=1 ;; Doesn't exist
Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
Else If vnPartTwo=0 ;; Win Server 2000 -> Server NT 5.0
Calculate psOS as 'Windows Server 2000'
Else
Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
End If
Else
Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
End If
Else ;; PC Versions
; -- Guess from the version number first
If vnPartOne=10 ;; NT 10.x
If iswindows10(kFalse)|vnPartTwo=0 ;; Win 10 -> NT 10.0
Calculate psOS as pick(iswindows10(kTrue),'Windows 10','Windows 10 (Themed)')
Else
Calculate psOS as con('Windows NT ',vnPartOne,'.',vnPartTwo)
End If
Else If vnPartOne=6 ;; NT 6.x
If iswindows81(kFalse)|vnPartTwo=3 ;; Win 8.1 -> NT 6.3
Calculate psOS as pick(iswindows81(kTrue),'Windows 8.1','Windows 8.1 (Themed)')
Else If iswindows8(kFalse)|vnPartTwo=2 ;; Win 8 -> NT 6.2
Calculate psOS as pick(iswindows8(kTrue),'Windows 8','Windows 8 (Themed)')
Else If iswindows7(kFalse)|vnPartTwo=1 ;; Win 7 -> NT 6.1
Calculate psOS as pick(iswindows7(kTrue),'Windows 7','Windows 7 (Themed)')
Else If isvista(kFalse)|vnPartTwo=0 ;; Win Vista -> NT 6.0
Calculate psOS as pick(isvista(kTrue),'Windows Vista','Windows Vista (Themed)')
Else
Calculate psOS as con('Windows NT ',vnPartOne,'.',vnPartTwo)
End If
Else If vnPartOne=5 ;; NT 5.x
Switch vnPartTwo
Case 0 ;; Win 2000 -> NT 5.0
Calculate psOS as 'Windows 2000'
Case 1 ;; Win XP -> NT 5.1
Calculate psOS as 'Windows XP'
Case 2 ;; XP Professional -> NT 5.2
Calculate psOS as 'Windows XP Professional x64'
Default
Calculate psOS as con('Windows NT ',vnPartOne,'.',vnPartTwo)
End Switch
; -- Then use Omnis' functions
Else If iswindows10(kFalse) ;; Win 10 - Put the most recent Windows OS first
Calculate psOS as pick(iswindows10(kTrue),'Windows 10','Windows 10 (Themed)')
Else If iswindows81(kFalse) ;; Win 8.1
Calculate psOS as pick(iswindows81(kTrue),'Windows 8.1','Windows 8.1 (Themed)')
Else If iswindows8(kFalse) ;; Win 8
Calculate psOS as pick(iswindows8(kTrue),'Windows 8','Windows 8 (Themed)')
Else If iswindows7(kFalse) ;; Win 7
Calculate psOS as pick(iswindows7(kTrue),'Windows 7','Windows 7 (Themed)')
Else If isvista(kFalse) ;; Win Vista
Calculate psOS as pick(isvista(kTrue),'Windows Vista','Windows Vista (Themed)')
Else
Calculate psOS as con('Windows NT ',vnPartOne,'.',vnPartTwo)
End If
End If
Regards,
Paul.
> On 5 Nov 2018, at 10:49 pm, Doug Easterbrook <doug at artsman.com> wrote:
>
> hi all.
>
> I’m finalizing/testing our code to help people get over to 64 bit OS and 64 bit application and I’ve run into an issue with sys(7) on windows.
>
> On mac, sys(7) will tell you the version of the operating system up to the latestMacOS day. perfect.
>
>
> On windows 10, I’f I’m running studio 5.2.3 runtime then sys(7) still returns 6.2 — telling me that Studio 5.2.3 thinks this is a windows 8 machine.
>
>
> does anybody have any code trick handy that will tell me what the current version of the windows operating system is (using studio 5)???
>
>
> all I really want to know is Windows 8 and before or Window 8.1 and later .. but it would be nice if I could get the exact version.
>
>
>
>
>
> Studio 8, other other hand … tells me nicely, but I need to know in studio 5 to suggest to get to studio 8.
>
>
>
>
> Doug Easterbrook
> Arts Management Systems Ltd.
> mailto:doug at artsman.com
> http://www.artsman.com
> Phone (403) 650-1978
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
"A user interface is well-designed when the program behaves exactly how the user thought it would."
Joel on Software
--
Paul W. Mulroney We Don't Do Simple Pty Ltd
pmulroney at logicaldevelopments.com.au Trading as Logical Developments
www.logicaldevelopments.com.au ACN 161 009 374
Ph: +61 8 9458 3889 86 Coolgardie Street
BENTLEY WA 6102
More information about the omnisdev-en
mailing list