Sign in to follow this  
Followers 0
bobbintb

@OSVersion for Windows 7

6 posts in this topic

Is there a way to find out if I am running Windows 7, short of looking at the OS type and build number? @OSVersion displays it as Vista.

Share this post


Link to post
Share on other sites



I do not have Windows 7 so I can't test this, but here is a little extra past what @OSVersion will give you.

Func _GetOSVersion()
    Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Local $colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
    For $objOperatingSystem In $colSettings
;~         Return $objOperatingSystem.Caption
        Return StringMid($objOperatingSystem.Caption, 19)
    Next
EndFunc   ;==>_getOSVersion

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Or run latest beta -> it is fixed there.

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Is there a way to find out if I am running Windows 7, short of looking at the OS type and build number? @OSVersion displays it as Vista.

italian = "il mio primo post, spero di aver capito"

Dim $ProductName,$CSDVersion,$BuildLab,$ProductId
$ProductName = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName")
$CSDVersion = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDVersion")
$BuildLab = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "BuildLab")
$ProductId = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId")
MsgBox(64, "","Informazioni sistema"&@CRLF&"Il tuo sistema operativo è: "&$ProductName&@CRLF&"Il tuo sistema service pack è: "&$CSDVersion&@CRLF&"Il tuo numero di laboratorio è: "&$BuildLab&@CRLF&"Il tuo id del prodotto è: "&$ProductId )

Share this post


Link to post
Share on other sites

thanks. i went to the beta but for some reason when i run the script in scite it doesnt work. only when i right click on the script and run it.

Share this post


Link to post
Share on other sites

I run testing on various OS's including Windows 7, and until the next release when the macro should be updated to include Windows 7, I put in a check of the registry to include what build number is running.

This is the function I use to return What OS, service pack and if we are running an 64 bit OS.

_OSVersion()
Func _OSVersion()
    Local $OS_Version, $servicepack_version
    $OS_Version = StringStripWS(StringRegExpReplace(@OSVersion, "(WIN_)|(Microsoft )|(Windows )|(\(TM\))|( Ultimate)", ""), 8)
    $OS_Version = StringRegExpReplace(StringRegExpReplace($OS_Version, '2008', 'Win7'), 'VISTA', 'Vista')
    If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", 'CurrentBuildNumber') > 7000 Then $OS_Version = 'Win7'
    $servicepack_version = StringReplace(@OSServicePack, "Service Pack ", "SP")
    If @error = -1 Then $servicepack_version = ""

    ConsoleWrite($OS_Version & $servicepack_version & StringRegExpReplace(@OSArch, '(X86)', '') & @CRLF)
    Return $OS_Version & $servicepack_version & StringRegExpReplace(@OSArch, '(X86)', '')
EndFunc   ;==>_OSVersion

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0