PPowerHouseK Posted December 22, 2010 Share Posted December 22, 2010 Hello, I need to be able to detect which operating system is installed and whether its 32 bit or 64 bit. I know there is a macro @OSVersion but I don't know how to use it, I cant seem to find the proper form to use it. Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
BrewManNH Posted December 22, 2010 Share Posted December 22, 2010 Practice with this: MsgBox(0, "", "CPU architecture = " & @OSArch & @CRLF & "OS Version = " & @OSVersion) If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Steveiwonder Posted December 22, 2010 Share Posted December 22, 2010 (edited) Hello, Try this $osv = @OSVersion $osBit = @OSArch MsgBox(0,"OS Version", "OS: " & $osv & @CRLF & "Bit: " & $osBit) ;or just MsgBox(0,"OS Version", "OS: " & @OSVersion & @CRLF & "Bit: " & @OSArch) Steve Edit: to slow Edited December 22, 2010 by Steveiwonder They call me MrRegExpMan Link to comment Share on other sites More sharing options...
PPowerHouseK Posted December 22, 2010 Author Share Posted December 22, 2010 Thank you! Link to comment Share on other sites More sharing options...
PPowerHouseK Posted December 22, 2010 Author Share Posted December 22, 2010 Okay that information was very helpful, I just need help making this loop work, I thought I would be okay with the syntax but apparently not. $osv = @OSVersion $ost = @OSArch MsgBox(0, "Version", "This is:" & @OSVersion) ;MsgBox(0, "", "CPU architecture = " & @OSArch & @CRLF & "OS Version = " & @OSVersion) MsgBox(0, "CPU Architecture", "This runs:" & @OSArch) If $osv = WIN_XP or WIN_XPe Then MsgBox(0, "", "Now Installing Xp Version...") Break(1) ElseIf $ost = X64 Then MsgBox(0, "", "Installing Vista/7 64 bit whatever") Break(1) Else MsgBox(0,"","Installing Vista/7 32 bit whatever") EndIf Link to comment Share on other sites More sharing options...
BrewManNH Posted December 22, 2010 Share Posted December 22, 2010 Try it this way, you missed the quotes around your comparison strings in your If..ElseIf statements $osv = @OSVersion $ost = @OSArch MsgBox(0, "Version", "This is:" & @OSVersion) ;MsgBox(0, "", "CPU architecture = " & @OSArch & @CRLF & "OS Version = " & @OSVersion) MsgBox(0, "CPU Architecture", "This runs:" & @OSArch) If $osv = "WIN_XP" Or "WIN_XPe" Then MsgBox(0, "", "Now Installing Xp Version...") Break(1) ElseIf $ost = "X64" Then MsgBox(0, "", "Installing Vista/7 64 bit whatever") Break(1) Else MsgBox(0, "", "Installing Vista/7 32 bit whatever") EndIf If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
PPowerHouseK Posted December 22, 2010 Author Share Posted December 22, 2010 hmm, thank you for the help with the comparison , but this shows I am running xp , yet I am using windows 7, any ideas? Link to comment Share on other sites More sharing options...
6105 Posted December 22, 2010 Share Posted December 22, 2010 Try it i writes it 1 year ago)) expandcollapse popup#include <GuiConstantsEx.au3> #include <ButtonConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> Opt('MustDeclareVars', 1) Local $VOL, $SERIAL, $TOTAL, $FREE, $contextMenu, $Group1 Local $Input_ComputerName, $Input_CurrentUserName, $Input_OperatingSystem Local $Input_ServicePack, $Input_VolumeLabel, $Input_SerialNumber Local $Input_TotalSpace, $Input_FreeSpace, $Input_IpAddress, $Input_StartupDirectory Local $Input_WindowsDirectory, $Input_SystemFolderDirectory, $Input_DesktopDirectory Local $Input_MyDocumentsDirectory, $Input_ProgramFilesDirectory, $Input_StartMenuDirectory Local $Input_TemporaryFileDirectory, $Input_DesktopWidth, $Input_DesktopHeight Local $Input_Date, $Input_Time, $msg #forceref $Input_ComputerName, $Input_CurrentUserName, $Input_OperatingSystem #forceref $Input_ServicePack, $Input_VolumeLabel, $Input_SerialNumber #forceref $Input_TotalSpace, $Input_FreeSpace, $Input_IpAddress, $Input_StartupDirectory #forceref $Input_WindowsDirectory, $Input_SystemFolderDirectory, $Input_DesktopDirectory #forceref $Input_MyDocumentsDirectory, $Input_ProgramFilesDirectory, $Input_StartMenuDirectory #forceref $Input_TemporaryFileDirectory, $Input_DesktopWidth, $Input_DesktopHeight #forceref $Input_Date, $Input_Time ; GUI GuiCreate("Second Test 400x400", 400, 400) GuiSetIcon(@SystemDir & "\wisptis.exe", 0) ; TAB GuiCtrlCreateTab(1, 0, 400, 401) GuiCtrlCreateTabItem("sysinfo") $Group1 = GUICtrlCreateGroup("Computer Information - By : Tudor", 5, 25, 390, 370, $BS_CENTER, $WS_EX_TRANSPARENT) $VOL = DriveGetLabel("C:\") $SERIAL = DriveGetSerial("C:\") $TOTAL = DriveSpaceTotal("C:\") $FREE = DriveSpaceFree("C:\") GUICtrlCreateLabel("Computer Name", 10, 40, 150, 16) GUICtrlCreateLabel("Current User Name", 10, 58, 150, 16) GUICtrlCreateLabel("Operating System", 10, 76, 150, 16) GUICtrlCreateLabel("Service Pack", 10, 94, 150, 16) GUICtrlCreateLabel("C: Volume Label", 10, 112, 150, 16) GUICtrlCreateLabel("C: Serial Number", 10, 130, 150, 16) GUICtrlCreateLabel("C: Total Space", 10, 148, 150, 16) GUICtrlCreateLabel("C: Free Space", 10, 166, 150, 16) GUICtrlCreateLabel("Ip Address", 10, 184, 150, 16) GUICtrlCreateLabel("Startup Directory", 10, 202, 150, 16) GUICtrlCreateLabel("Windows Directory", 10, 220, 150, 16) GUICtrlCreateLabel("System Folder Directory", 10, 238, 150, 16) GUICtrlCreateLabel("Desktop Directory", 10, 256, 150, 16) GUICtrlCreateLabel("My Documents Directory", 10, 274, 150, 16) GUICtrlCreateLabel("Program File Directory", 10, 292, 150, 16) GUICtrlCreateLabel("Start Menu Directory", 10, 310, 150, 16) GUICtrlCreateLabel("Desktop Width (Pixels)", 10, 328, 150, 16) GUICtrlCreateLabel("Temporary File Directory", 10, 346, 150, 16) GUICtrlCreateLabel("Desktop Height (Pixels)", 10, 364, 150, 16) $Input_ComputerName = GUICtrlCreateInput("" & @ComputerName, 180, 40, 210, 16) $Input_CurrentUserName = GUICtrlCreateInput("" & @UserName, 180, 58, 210, 16) $Input_OperatingSystem = GUICtrlCreateInput("" & @OSTYPE &", "& @OSVersion, 180, 76, 210, 16) $Input_ServicePack = GUICtrlCreateInput("" & @OSServicePack, 180, 94, 210, 16) $Input_VolumeLabel = GUICtrlCreateInput("" & $VOL, 180, 112, 210, 16) $Input_SerialNumber = GUICtrlCreateInput("" & $SERIAL, 180, 130, 210, 16) $Input_TotalSpace = GUICtrlCreateInput("" & $TOTAL, 180, 148, 210, 16) $Input_FreeSpace = GUICtrlCreateInput("" & $FREE, 180, 166, 210, 16) $Input_IpAddress = GUICtrlCreateInput("" & @IPAddress1, 180, 184, 210, 16) $Input_StartupDirectory = GUICtrlCreateInput("" & @StartupDir, 180, 202, 210, 16) $Input_WindowsDirectory = GUICtrlCreateInput("" & @WindowsDir, 180, 220, 210, 16) $Input_SystemFolderDirectory = GUICtrlCreateInput("" & @SystemDir, 180, 238, 210, 16) $Input_DesktopDirectory = GUICtrlCreateInput("" & @DesktopDir, 180, 256, 210, 16) $Input_MyDocumentsDirectory = GUICtrlCreateInput("" & @MyDocumentsDir, 180, 274, 210, 16) $Input_ProgramFilesDirectory = GUICtrlCreateInput("" & @ProgramFilesDir, 180, 292, 210, 16) $Input_StartMenuDirectory = GUICtrlCreateInput("" & @StartMenuDir, 180, 310, 210, 16) $Input_TemporaryFileDirectory = GUICtrlCreateInput("" & @TempDir, 180, 328, 210, 16) $Input_DesktopWidth = GUICtrlCreateInput("" & @DesktopWidth, 180, 346, 210, 16) $Input_DesktopHeight = GUICtrlCreateInput("" & @DesktopHeight, 180, 364, 210, 16) GuiCtrlCreateTabItem("Two") GuiCtrlCreateLabel("Test Tab", 200, 100) GuiCtrlCreateTabItem("Three") GuiCtrlCreateLabel("Test Tab", 200, 200) GuiCtrlCreateTabItem("Four") GuiCtrlCreateLabel("Test Tab", 200, 300) GuiCtrlCreateTabItem("") ; CONTEXT MENU $contextMenu = GuiCtrlCreateContextMenu() GuiCtrlCreateMenuItem("Context Menu", $contextMenu) GuiCtrlCreateMenuItem("", $contextMenu) ;separator GuiCtrlCreateMenuItem("&Properties", $contextMenu) ; GUI MESSAGE LOOP GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center] Link to comment Share on other sites More sharing options...
BrewManNH Posted December 22, 2010 Share Posted December 22, 2010 hmm, thank you for the help with the comparison , but this shows I am running xp , yet I am using windows 7, any ideas?I don't know, because under Windows 7 on one of my computers it shows WIN_7 and an xp machine shows WIN_XP. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
ZacUSNYR Posted December 22, 2010 Share Posted December 22, 2010 If $osv = "WIN_XP" Or $osv = "WIN_XPe" Then Try that Link to comment Share on other sites More sharing options...
PPowerHouseK Posted December 22, 2010 Author Share Posted December 22, 2010 That did the trick Zac, Thanks!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now