DigDeep Posted May 22, 2019 Share Posted May 22, 2019 I am having a weird issue. Both my INI file and App1.exe properties version are 1.0.2345.17509 But when I validate, it gives me the msgbox "False". I also tried changing the Filegetversion() to RegRead but it is still the same. I am not sure but could it be a false reading of binary digits? Local $Test_LocalFile = "C:\Program Files\Test\App1.exe" Local $Test_LocalFile_Ver = FileGetVersion($Test_LocalFile, "ProductVersion") Local $Test_SourceFile_Ver = IniRead("c:\Test.ini", "Apps", "App1", "") If $Test_LocalFile_Ver = $Test_SourceFile_Ver Then MsgBox(0, "", "True") Else MsgBox(0, "", "False") EndIf Link to comment Share on other sites More sharing options...
Developers Jos Posted May 22, 2019 Developers Share Posted May 22, 2019 Try running with #RequireAdmin. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AdamUL Posted May 22, 2019 Share Posted May 22, 2019 Use the _VersionCompare function for comparing file versions. #include <Misc.au3> Local $Test_LocalFile = "C:\Program Files\Test\App1.exe" Local $Test_LocalFile_Ver = FileGetVersion($Test_LocalFile, "ProductVersion") Local $Test_SourceFile_Ver = IniRead("c:\Test.ini", "Apps", "App1", "") If _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) = 0 Then MsgBox(0, "", "True") Else MsgBox(0, "", "False") EndIf Adam Link to comment Share on other sites More sharing options...
DigDeep Posted May 23, 2019 Author Share Posted May 23, 2019 (edited) @Jos, I am already running as #RequireAdmin. @AdamUL, it give the same False result. I have loads of other validations which are all correct. It is just this file which shows opposite result. 🤨 But when I change it as: If _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) = 0 Or _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) = 1 Then MsgBox(0, "", "True") Else MsgBox(0, "", "False") EndIf So _VersionCompare works in this case. But as per help file it as 3 validations which is why we can't put only = 0 and Else. 0 - Both versions equal 1 - Version 1 greater -1 - Version 2 greater End of the line, this works as per my need. Thank you. Edited May 23, 2019 by DigDeep Link to comment Share on other sites More sharing options...
jchd Posted May 23, 2019 Share Posted May 23, 2019 Make that elegant (only one function call): ; verbose Local $res = _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) Switch $res Case -1 MsgBox(0, "", "Older") Case 0 MsgBox(0, "", "Same") Else MsgBox(0, "", "Newer") EndSwitch ; compact alternative Local $res = _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) MsgBox(0, "", $res < 0 ? "Older" : ($res = 0 ? "Same" : "Newer")) This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
JackER4565 Posted May 23, 2019 Share Posted May 23, 2019 Could be the case that you are comparing values and it is a string? 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