gr1fter Posted June 18, 2010 Share Posted June 18, 2010 (edited) I want to check a file version but I have 2 different versions i want to check again and this doesnt seem to work right...it is only picking up the first value after the <> $ms1 = @SystemDir & "\msxml4.dll" $verxp1 = "4.30.2100.0" $verxp2 = "4.20.9876.0" $ver = FileGetVersion($ms1) If $ver <> $verxp1 OR $verxp2 Then $ans = MsgBox(1, "","Additional components are required. Your Version is: " & $ver ) Else MsgBox(1, "","We are good to go!") Exit EndIf Edited June 18, 2010 by gr1fter Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 18, 2010 Share Posted June 18, 2010 (edited) Try: If ($ver = $verxp1) OR ($ver = $verxp2) Then ; Match Else ; No match EndIf Or: Switch $ver Case $verxp1, $verxp2 ; Match Case Else ; No match EndSwitch Edited June 18, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
UEZ Posted June 18, 2010 Share Posted June 18, 2010 (edited) You have to use $ver again to compare it with 2nd variable!If $ver <> $verxp1 OR $ver <> $verxp2 Then$ms1 = @SystemDir & "\msxml4.dll" $verxp1 = "4.30.2100.0" $verxp2 = "4.20.9876.0" $ver = FileGetVersion($ms1) If $ver <> $verxp1 OR $ver <> $verxp2 Then $ans = MsgBox(1, "","Additional components are required. Your Version is: " & $ver ) Else MsgBox(1, "","We are good to go!") Exit EndIfBR,UEZ Edited June 18, 2010 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
gr1fter Posted June 18, 2010 Author Share Posted June 18, 2010 (edited) $ms1 = @SystemDir & "\msxml4.dll" $verxp1 = "4.30.2100.0" $verxp2 = "4.20.9876.0" $ver = FileGetVersion($ms1) If $ver <> $verxp1 OR $ver <> $verxp2 Then $ans = MsgBox(1, "","Additional components are required. Your Version is: " & $ver ) Else MsgBox(1, "","We are good to go!") Exit EndIf I tried all your suggestions and did not work My test machine has version 4.20.9876.0 of the file i am checking So it should go to "We are good to go!" but it doesnt... If i do this... it works fine... $ms1 = @SystemDir & "\msxml4.dll" $verxp1 = "4.30.2100.0" $verxp2 = "4.20.9876.0" $ver = FileGetVersion($ms1) If $ver <> $verxp2 Then $ans = MsgBox(1, "","Additional components are required. Your Version is: " & $ver ) Else MsgBox(1, "","We are good to go!") Exit EndIf I just can't seem to check on 2 different file versions Thank you for the help Edited June 18, 2010 by gr1fter Link to comment Share on other sites More sharing options...
UEZ Posted June 18, 2010 Share Posted June 18, 2010 I cannot follow your logic here! What do you want to check exactly? If you want to check whether $ver has version "4.20.9876.0" then you can do it with If $ver = $verxp2 Then MsgBox(1, "","We are good to go!") Exit Else $ans = MsgBox(1, "","Additional components are required. Your Version is: " & $ver ) EndIf Or you want to check $verxp1 and $verxp2 you can do this: If $ver = $verxp2 Then MsgBox(1, "","We are good to go!") Exit ElseIf $ver = $verxp1 MsgBox(1, "","File is newer!") Exit Else $ans = MsgBox(1, "","Additional components are required. Your Version is: " & $ver ) EndIf Br, 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
gr1fter Posted June 18, 2010 Author Share Posted June 18, 2010 I'll try to explain my logic. I dont want to use = I thought <> was the same as NOT so i have two file versions. 1 file version = 4.30.2100.0 and the other file version = 4.20.9876.0 If i run this on a machine and I detect the following: IF File Version (4.30.2100.0) is NOT there then say "Additional components are required." IF File Version (4.20.9876.0) is NOT there then say "Additional components are required." IF one of the File Version is (4.30.2100.0) OR (4.20.9876.0) THEN go head and say (We are good to go!) The problem I am having is even though I DO have File Version (4.30.2100.0) or (4.20.9876.0) on the machine it is still telling me that I need "Additional components are required." When it should be telling me "We are good to go" Hope that makes sense! Link to comment Share on other sites More sharing options...
Bowmore Posted June 18, 2010 Share Posted June 18, 2010 You were almost there. If $ver <> $verxp1 Or $ver <> $verxp2 Thenshould have been If $ver <> $verxp1 And $ver <> $verxp2 Then$ms1 = @SystemDir & "\msxml4.dll" $verxp1 = "4.30.2100.0" $verxp2 = "4.20.9876.0" $ver = FileGetVersion($ms1) If $ver <> $verxp1 And $ver <> $verxp2 Then $ans = MsgBox(1, "","Additional components are required. Your Version is: " & $ver ) Else MsgBox(1, "","We are good to go!") Exit EndIf "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
UEZ Posted June 18, 2010 Share Posted June 18, 2010 Or you can use this: If $ver = $verxp1 OR $ver = $verxp2 Then MsgBox(1, "","We are good to go!") Exit Else $ans = MsgBox(1, "","Additional components are required. Your Version is: " & $ver ) EndIf BR, 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
gr1fter Posted June 18, 2010 Author Share Posted June 18, 2010 You were almost there. If $ver <> $verxp1 Or $ver <> $verxp2 Then should have been If $ver <> $verxp1 And $ver <> $verxp2 Then $ms1 = @SystemDir & "\msxml4.dll" $verxp1 = "4.30.2100.0" $verxp2 = "4.20.9876.0" $ver = FileGetVersion($ms1) If $ver <> $verxp1 And $ver <> $verxp2 Then $ans = MsgBox(1, "","Additional components are required. Your Version is: " & $ver ) Else MsgBox(1, "","We are good to go!") Exit EndIf That was it! I dont know why i was insisted it being OR, it seemed like the right choice... THanks you all for the help! 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