muncherw Posted April 24, 2009 Share Posted April 24, 2009 (edited) I have the same compiled script on my desktop and on a network drive. When I use _VersionCompare it always returns a -1. If I make the local vesion newer than the network version it returns -1 instead of 1. What am I doing wrong? Thanks. $sVersion1 = @ScriptDir & "\Port Enabler.exe" $sVersion2 = "O:\Network\Technicians\Muncher\Port Enabler\Port Enabler.exe" $result = _VersionCompare($sVersion1, $sVersion2) If $result = 0 Then ; Files are the same. Do nothing. MsgBox(0, "Up to Date", "You are using the most current version of the port enabler.") ElseIf $result = 1 Then ; This version is more up-to-date. Only really possible for Muncher. ; Do nothing. MsgBox(0, "Weird", "No one should see this but me.") ElseIf $result = -1 Then ;Network version is newer. Need to upgrade. MsgBox(0, "Newer version available", "Please run the updater.") EndIf Edited April 24, 2009 by muncherw Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic] Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 24, 2009 Share Posted April 24, 2009 I have the same compiled script on my desktop and on a neetwork drive. When I use _VersionCompare it always returns a -1. If I make the local vesion newer than the network version it returns -1 instead of 1. What am I doing wrong? Thanks. $sVersion1 = @ScriptDir & "\Port Enabler.exe" $sVersion2 = "O:\Network\Technicians\Muncher\Port Enabler\Port Enabler.exe" $result = _VersionCompare($sVersion1, $sVersion2) If $result = 0 Then ; Files are the same. Do nothing. MsgBox(0, "Up to Date", "You are using the most current version of the port enabler.") ElseIf $result = 1 Then ; This version is more up-to-date. Only really possible for Muncher. ; Do nothing. MsgBox(0, "Weird", "No one should see this but me.") ElseIf $result = -1 Then ;Network version is newer. Need to upgrade. MsgBox(0, "Newer version available", "Please run the updater.") EndIf The input to the function is the version string, not the path. Try: $result = _VersionCompare(FileGetVersion($sVersion1), FileGetVersion($sVersion2)) 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...
Moderators Melba23 Posted April 24, 2009 Moderators Share Posted April 24, 2009 muncherw,The arguments for _VersionCompare are the numeric version numbers - like 3.3.0.0 or 32.45.2.198.You should be able to get these by using FileGetVersion - assuming the author has set them. ;-)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
muncherw Posted April 24, 2009 Author Share Posted April 24, 2009 The input to the function is the version string, not the path. Try: $result = _VersionCompare(FileGetVersion($sVersion1), FileGetVersion($sVersion2)) Oooooooooooooh! That does it. Thanks! Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic] Link to comment Share on other sites More sharing options...
muncherw Posted April 24, 2009 Author Share Posted April 24, 2009 muncherw,The arguments for _VersionCompare are the numeric version numbers - like 3.3.0.0 or 32.45.2.198.You should be able to get these by using FileGetVersion - assuming the author has set them. ;-)M23I am the last author..and yes I did set them. I even had some msgboxes in there to debug so when they were displaying the correct version number but I still was getting a bad comparison I was really confused. Thanks for your help. Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic] 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