GordonFreeman Posted July 14, 2014 Share Posted July 14, 2014 I do not know how can i tell this operation. But i am trying to get the flag in a string but it looks returning position. In Win7 SP1 i get 0x00010000 but the correct must be 0x00001000 expandcollapse popupMsgBox(0,0,Binary(_GetOSFlag())) Func _GetOSFlag() Local $iOSFlag If @OSVersion = "WIN_XP" Then If @OSServicePack = "Service Pack 1" Then $iOSFlag = 2 ElseIf @OSServicePack = "Service Pack 2" Then $iOSFlag = 4 ElseIf @OSServicePack = "Service Pack 3" Then $iOSFlag = 8 Else $iOSFlag = 1 EndIf ElseIf @OSVersion = "WIN_VISTA" Then If @OSServicePack = "Service Pack 1" Then $iOSFlag = 32 ElseIf @OSServicePack = "Service Pack 2" Then $iOSFlag = 64 Else $iOSFlag = 16 EndIf ElseIf @OSVersion = "WIN_7" Then If @OSServicePack = "Service Pack 1" Then $iOSFlag = 256 Else $iOSFlag = 128 EndIf ElseIf @OSVersion = "WIN_8" Then $iOSFlag = 512 ElseIf @OSVersion = "WIN_81" Then $iOSFlag = 1024 EndIf Return $iOSFlag EndFunc;_GetOSFlag Frabjous Installation Link to comment Share on other sites More sharing options...
BrewManNH Posted July 14, 2014 Share Posted July 14, 2014 Don't use Binary, use Hex 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...
GordonFreeman Posted July 14, 2014 Author Share Posted July 14, 2014 Don't use Binary, use Hex Ok, with Hex works but only returns 8 numbers instead of 11 Frabjous Installation Link to comment Share on other sites More sharing options...
BrewManNH Posted July 14, 2014 Share Posted July 14, 2014 It should return up to 16 digits, if it's not showing the full length try using the length parameter and/or stringformat with it. 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...
GordonFreeman Posted July 15, 2014 Author Share Posted July 15, 2014 (edited) Lol. I see wrong, with hex not work, because it returns Win Vista SP1 Anyway i do a code who works, but maybe hard to compare, how can i match now? I need match by example, 0x00010001100 with 0x00000000100 return True Its mean who WinXP SP3 and Win 7 and Win7 SP1 is checked and match with my system Win SP1, Then return True expandcollapse popupMsgBox(0,0,_GetOSFlag()) Func _GetOSFlag() Local $iOSFlag If @OSVersion = "WIN_XP" Then If @OSServicePack = "Service Pack 1" Then $iOSFlag = "01000000000" ElseIf @OSServicePack = "Service Pack 2" Then $iOSFlag = "00100000000" ElseIf @OSServicePack = "Service Pack 3" Then $iOSFlag = "00010000000" Else $iOSFlag = "10000000000" EndIf ElseIf @OSVersion = "WIN_VISTA" Then If @OSServicePack = "Service Pack 1" Then $iOSFlag = "00000100000" ElseIf @OSServicePack = "Service Pack 2" Then $iOSFlag = "00000010000" Else $iOSFlag = "00001000000" EndIf ElseIf @OSVersion = "WIN_7" Then If @OSServicePack = "Service Pack 1" Then $iOSFlag = "00000000100" Else $iOSFlag = "00000001000" EndIf ElseIf @OSVersion = "WIN_8" Then $iOSFlag = "00000000010" ElseIf @OSVersion = "WIN_81" Then $iOSFlag = "00000000001" EndIf Return $iOSFlag EndFunc;_GetOSFlag Ok. Not the best way, but i can do it works with this func expandcollapse popupMsgBox(0,"",_CheckOSFlag("00010001100",_GetOSFlag())) Func _CheckOSFlag($iCfgOSFlag,$iOSFlag) If StringMid($iCfgOSFlag,StringInStr($iOSFlag,1),1) = 1 Then Return 1 Else Return 0 EndIf EndFunc;_CheckOSFlag Func _GetOSFlag() Local $iOSFlag If @OSVersion = "WIN_XP" Then If @OSServicePack = "Service Pack 1" Then $iOSFlag = "01000000000" ElseIf @OSServicePack = "Service Pack 2" Then $iOSFlag = "00100000000" ElseIf @OSServicePack = "Service Pack 3" Then $iOSFlag = "00010000000" Else $iOSFlag = "10000000000" EndIf ElseIf @OSVersion = "WIN_VISTA" Then If @OSServicePack = "Service Pack 1" Then $iOSFlag = "00000100000" ElseIf @OSServicePack = "Service Pack 2" Then $iOSFlag = "00000010000" Else $iOSFlag = "00001000000" EndIf ElseIf @OSVersion = "WIN_7" Then If @OSServicePack = "Service Pack 1" Then $iOSFlag = "00000000100" Else $iOSFlag = "00000001000" EndIf ElseIf @OSVersion = "WIN_8" Then $iOSFlag = "00000000010" ElseIf @OSVersion = "WIN_81" Then $iOSFlag = "00000000001" EndIf Return $iOSFlag EndFunc;_GetOSFlag Thanks by attention BrewMan! Edited July 15, 2014 by GordonFreeman Frabjous Installation 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