Jump to content

Quick Dirty method: Check for new version?


Recommended Posts

I have an application that I need to implement and autoupdate function. When the app launches, I will call another .exe that will read an update path from an .ini file. It will then need to check for a new version of the my applications .exe file on a network share. My question is, what is a reliable quick, dirty way of doing this.......as far as comparing the two files (the one currently on the users machine, and the one out on the network share). Thanks for any suggestions. I did some digging in the Example scripts forum but wasn't able to run across anything there.

-hogfan

Link to comment
Share on other sites

I had problems with File Get version and had to make one to look at creation date instead, small piece below

This is not network but should be adaptable

#include <Date.au3>
#include _FileGetProperty.au3

$CB1_path_64 = "C:\Program Files (x86)\AVG\AVG10\avgtray.exe"
$CB1_path_pen_64 = @ScriptDir & "\file_includes\install_avg_64.exe"
;<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>
    If FileExists($CB1_path_64) Then
    $CB1_inst_ver = StringTrimRight(_FileGetProperty($CB1_path_64,"Date Created"), 9) ; searches for the file then trims the hrs off to leave just the date
    $CB1_pen_ver = StringTrimRight(_FileGetProperty($CB1_path_pen_64,"Date Created"), 9)
    Else
    $CB1_inst_ver = "01/01/2011"
    $CB1_pen_ver = StringTrimRight(_FileGetProperty($CB1_path_pen_64,"Date Created"), 9)
    EndIf
EndIf
$CB1_I_ver = StringRegExpReplace($CB1_inst_ver, "\A(\d*)/(\d*)/(\d*)","$3/$2/$1"); changes the date to an autoit readable form
$CB1_P_ver = StringRegExpReplace($CB1_pen_ver, "\A(\d*)/(\d*)/(\d*)","$3/$2/$1")

If _DateDiff( "D", $CB1_I_ver, $CB1_P_ver) < 21 Then; tests against 21 days difference
"your code below

This uses the FileGetProperty UDF which is available here

Like i say not exactly what you want but might start you off

Plus you can search for other things from the file details with this UDF

Edited by Chimaera
Link to comment
Share on other sites

You need to indicate version in directives of your script

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Without this indication FileGetVersion will return AutoIt Version.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...