RickB75 Posted January 13, 2015 Share Posted January 13, 2015 Guys I'm looking for some advice on the best way to check for an updated file on a server. I'll explain. I have my main script on multiple PC's. I want to be able to update the main script (which is a .exe) by having the script to check for a updated version. I know how to use Autoit and set the file version. I'm just wondering what's the best way to go about this. From what I can tell, I can't get the file version info via FTP. I probably could look for the dates and compare the dates on the local file to the remote file on the server but my question about this method is, are the formatted dates on PC's the same? Could my date format be YY/DD/MM and yours be MM/DD/YYYY. I'm thinking I could run into issues using the date creation or modified method. I was also thinking about using the File size but I'm running into issues with that as well. Yesterday I did a test. Using the same file, I complied the same script but on the second compile, I added another include folder and more commented out text and the file size was the exact same. I would have thought they would have been different sizes but they weren't. I was going have the script check for a file in the remote dir and if one exist, then just download and delete it from the server but by do that, I have no way of knowing what version of the main script that particular PC is running. Any advice??? Link to comment Share on other sites More sharing options...
MikahS Posted January 13, 2015 Share Posted January 13, 2015 Why not just use FileGetVersion? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
RickB75 Posted January 13, 2015 Author Share Posted January 13, 2015 (edited) How can I get the version of the remote file. I can get the version of the local file but once I have the local version, I need to get the version of the remote file and compare. Looking in the help file the the function that gives me the most info about the file is _FTP_ListToArrayEx. Is there a diff function that I can use to get the version info for the remote file? Edited January 13, 2015 by RickB75 Link to comment Share on other sites More sharing options...
jdelaney Posted January 13, 2015 Share Posted January 13, 2015 DriveMapAdd DriveMapGet FileGetVersion FileGetTime IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Valuater Posted January 13, 2015 Share Posted January 13, 2015 I did one before... FileGetVersion() of the exe version I had a data file online, it would check every 3 days, download the data file,read the first line...because it was the latest version compare the versions and download the exe or update if needed 8) Link to comment Share on other sites More sharing options...
MikahS Posted January 13, 2015 Share Posted January 13, 2015 (edited) either install AutoIt on this computer, and signal a script to start that checks the version against the specified new version, or use jdelaney's way, which would probably be much either. Edited January 13, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
RickB75 Posted January 13, 2015 Author Share Posted January 13, 2015 Thanks guys. I like both solutions and I think either one of them will work for my needs. I'm not as familiar with jdelaney's approach as I am with Valuater's. Once again, thank you for your advice. Link to comment Share on other sites More sharing options...
Valuater Posted January 13, 2015 Share Posted January 13, 2015 I used INetGet() to simply download the data file 8) Link to comment Share on other sites More sharing options...
guinness Posted January 13, 2015 Share Posted January 13, 2015 (edited) Or use the WinHTTP UDF to compare the created/modified date by sending a HEAD request to the server. Then you don't have to download the whole file.Functions you will need:_WinHttpOpen_WinHttpConnect_WinHttpOpenRequest ; $sVerb parameter should be HEAD_WinHttpSendRequest_WinHttpReceiveResponse_WinHttpQueryHeaders ; $WINHTTP_QUERY_LAST_MODIFIED Edited January 13, 2015 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
MikahS Posted January 13, 2015 Share Posted January 13, 2015 No problem, glad to help. Mapping a drive letter is just creating a connection to another machines specified folder, that would be my approach, but all the approaches I'm sure would work out for you. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
guinness Posted January 13, 2015 Share Posted January 13, 2015 Oh and if you go down the route of version comparison, then look at _VersionCompare(). UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
RickB75 Posted January 13, 2015 Author Share Posted January 13, 2015 @guinness I didn't know that function (_VersionCompare) existed. Wow! Thank you guys. Link to comment Share on other sites More sharing options...
Valuater Posted January 13, 2015 Share Posted January 13, 2015 I always used ping() test test for internet connection... Actually the inetget() is small and fast downloading a 1 line file While 1 If Ping("www.google.com", 4000) > 0 Then ExitLoop If MsgBox(262149, "ClickTask.com - Updater", "an internet connection is required ", 10) = 2 Then Exit WEnd Link to comment Share on other sites More sharing options...
Valuater Posted January 13, 2015 Share Posted January 13, 2015 Chopping out of old stuff here... $Version = FileGetVersion() If InetGet($Website & "/Data.txt", $readtemp, 1) = 1 Then $itemp = FileRead($readtemp) FileDelete($readtemp) _VersionCompare() ; Download new version 8) Link to comment Share on other sites More sharing options...
RickB75 Posted January 13, 2015 Author Share Posted January 13, 2015 I do like that Valuater. I was going to use _ftp_fileread but it's returning the contents back in binary. Then I would have to convert that. I'm wondering if I could put the version info in the header some how / where and use WinHttp to read it and then use _VersionCompare. Just a thought. Link to comment Share on other sites More sharing options...
Valuater Posted January 13, 2015 Share Posted January 13, 2015 If you use the data file then read the first line...there is no need to change the file name in the prog or on the server Inet is really easy to use 8) Link to comment Share on other sites More sharing options...
RickB75 Posted January 13, 2015 Author Share Posted January 13, 2015 I'm gonna give it a shot real quick. I think your right. That prob is the easiest approach. Link to comment Share on other sites More sharing options...
RickB75 Posted January 13, 2015 Author Share Posted January 13, 2015 (edited) works like a charm. Thanks Valuater Also, thanks to you other guys for pitching in as well. @guinness The _VersionCompare is awesome. Thanks for mentioning!! Edited January 13, 2015 by RickB75 Link to comment Share on other sites More sharing options...
Valuater Posted January 13, 2015 Share Posted January 13, 2015 works like a charm. Thanks Valuater Welcome! 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 13, 2015 Moderators Share Posted January 13, 2015 (edited) Guess I did things the hard way. I just put an ini one of my server folders, had php code to read the ini, and did a simple _ienetgetsource("http://myurl.com/phpFileToDoTheWork?fversion=getCurrentVersion"), the inetgetsource returned my fileversion that the php file spit out and I did a version compare locally. I liked this method because I logged real time stats. Edit: I should say this too... later I got more advanced with the php, where I made it return the actual code and message to display (if any). This allowed me to edit my exe strings without actually having to go into the script, change/add the code, recompile, and having the end-user have to redownload and restart. Unfortunately, that coding (years worth) were not backed up in the cloud and was lost in the fire. Edited January 13, 2015 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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