Jump to content
Sign in to follow this  
muncherw

_VersionCompare error (Solved)

Recommended Posts

muncherw

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 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]

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
Melba23

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
muncherw

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]

Share this post


Link to post
Share on other sites
muncherw

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

I 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]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×