jhdvy
(Fresh Scripter)
2002-04-11 05:16 PM
determine os version

I had this running in a script to determine the OS. Now that is switched from kixtart 3.63 4.02 it doesn't work anymore. I know there are a lot of ways to do this but some are way too long. I just want to simply know the OS type.

Here is what I have:

Select
Case ((@INWIN = 1) And (@DOS = 5.0))
$OS = "Win2K"
Case ((@INWIN = 1) And (@DOS = 4.0))
$OS = "WinNT4"
Case ((@INWIN = 2) And (@DOS >= 4.10))
$OS = "Win98"
Case ((@INWIN = 2) And (@DOS = 4.0))
$OS = "Win95"
EndSelect

"Running""$os"

On 3.62 the output wass fine. On 4.02 I get $os as the output.

Thanks


Rocco Capra
(Hey THIS is FUN)
2002-04-11 05:25 PM
Re: determine os version

I didn't test this on Win98, but try this...

? "[ @INWIN ][ @DOS ]"
? ""

SELECT
CASE((@INWIN = "1") And (@DOS = "5.0"))
$OS = "Win2K"
CASE((@INWIN = "1") And (@DOS = "4.0"))
$OS = "WinNT4"
CASE((@INWIN = "2") And (@DOS > "4.0"))
$OS = "Win98"
CASE((@INWIN = "2") And (@DOS = "4.0"))
$OS = "Win95"
ENDSELECT
? "Running " + "$os"
? ""

Rocco

[ 11 April 2002, 17:31: Message edited by: Rocco Capra ]


Sealeopard
(KiX Master)
2002-04-11 05:25 PM
Re: determine os version

Try this:
code:
Select
Case ((@INWIN = 1) And (@DOS = 5.0))
$OS = "Win2K"
Case ((@INWIN = 1) And (@DOS = 4.0))
$OS = "WinNT4"
Case ((@INWIN = 2) And (@DOS >= 4.10))
$OS = "Win98"
Case ((@INWIN = 2) And (@DOS = 4.0))
$OS = "Win95"
EndSelect

? 'Running ' + $os

Also, take a look at the @PRODUCTTYPE, that'll give you a little bit more granularity

[ 11 April 2002, 17:28: Message edited by: sealeopard ]


Howard Bullock
(KiX Supporter)
2002-04-11 05:29 PM
Re: determine os version

The @DOS macro returns a text string so put quotes around your numbers like @DOS = "5.0".

You may also want to add a "CASE 1" at the end of your select to catch any unexpected data.

[ 11 April 2002, 17:54: Message edited by: Howard Bullock ]


jhdvy
(Fresh Scripter)
2002-04-11 05:52 PM
Re: determine os version

Thanks everyone!!

MCA
(KiX Supporter)
2002-04-14 06:25 AM
Re: determine os version

Dear,

A more complete script can be:
code:
  $os=""
SELECT
CASE (@inwin = 1) AND (@dos = "5.1") ; - Windows XP -
$os="XP"
CASE (@inwin = 1) AND (@dos = "5.0") ; - Windows 2000 -
$os="W2K"
CASE (@inwin = 1) ; - Windows NT -
$os="NT4"
CASE (@inwin <> 1) AND (@dos = "4.90") ; - Windows ME -
$os="ME"
CASE (@inwin <> 1) AND (@dos = "4.10") ; - Windows 98 -
$os="W98"
CASE (@inwin <> 1) AND (@dos = "4.0") ; - Windows 95 -
$os="W95"
CASE 1
$os="???" ; - undetermined -
ENDSELECT
? "$$os "+$os

greetings.


netixpc
(Fresh Scripter)
2002-04-18 02:55 AM
Re: determine os version

Use the new @producttype command available in KIX v4.x.

It's really more simple than the @inwin and @dos in the script. Try:

IF @PRODUCTTYPE = "Windows 95"
Blah, Blah...
ENDIF

There is a list of @PRODUCTTYPE in the KIX manual.