Sign in to follow this  
Followers 0
PartyPooper

INetUpdater UDF

23 posts in this topic

#1 ·  Posted (edited)

A simple UDF that can be used for downloading a program update via the internet. Includes a progress bar and an option to automatically update the currently running program.

Sample usage:

#include <INetUpdater.au3>
   
Global $s_Version = "v1.0.0.6"; current version
Global $s_MyWebSite = "http://members.optusnet.com.au/partypooper"; authors web address
           
OnGetFileUpdate()
           
Func OnGetFileUpdate()
  _INetUpdater ($s_Version, $s_MyWebSite)
EndFunc;==>OnGetFileUpdate

Format for the UDF is as follows:

#include <INetUpdater.au3>
   
Func _INetUpdater( Current Version, Web Site [, Program Title [, Version Control File [, Remote Filename [, Local Filename [, Updating BatchFile [, Auto Install]]]]] )

Parameters

Current Version - currently running program version number

Web Site - website containing version file and the update

Program Title - Title of the update. Default (-1) = currently running program title (must be the same in Updates.ini)

Version Control File - Ini file on website containing version number. Default (-1) = Updates.ini (see format in Remarks below)

Remote Filename - executable to be downloaded. Default (-1) = "Program Title".exe

Local Filename - executable filename to be saved locally. Default (-1) = same as Remote Filename

Updating BatchFile - batch updater filename. Default (-1) = "Program Title" Update.bat

Auto Install - auto install after downloading 0=no, 1=yes. Default (0) = manually install update

Return Value

On Success: Downloads and auto installs (if chosen), the update.

On Failure:

- sets @ERROR = 1 for function parameter errors

- sets @ERROR = 2 if internet problems or version file not found

- sets @ERROR = 3 if updating batch file cannot be created

Remarks

Requires that you have a version control file located on your server that has a section name of '[program title]' and a key of 'Vers='. The Version number can be any format so long as it can be used as a comparision string between program and update. The [program title] must be identical to the one used in the script. Example format for the version ini file:

[My Program]
Vers=v3.0.0.0
[Another Program]
Vers=v1.0

etc...

If "Vers=Manual", this will trigger a message box stating user must visit website to manually update file.

Edit1: Updated UDF source (4 downloads)

Edit2: Clarification of version control file format.

Edit3: Updated UDF source - removed requirement for running exe to use differnet filename (16 downloads)

Edit4: Updated UDF source - many changes (197 downloads)

Edit5: Updated UDF source - fixed small error that may stop an update from occuring (2 downloads)

Edit6: Updated UDF source - fixed potential splash text bug. Code cleanup and added Manually Update File option. Splash/Progress now centers on calling script GUI - useful in multi-monitor scenarios (257 downloads)

Edit7: Updated UDF source - changed number of arguments required (and their order) so it will be a script breaker without some editing. No longer needs program title - now picked up automatically. (2 downloads)

Edit8: Updated UDF source - several bugfixes (8 downloads)

Edit9: Updated UDF source - more bugfixes (1 download)

Edit10: Updated UDF source - reworked the batchfile routine and added a time delay

NO LONGER BEING MAINTAINED - superseded by @InetFileUpdate

Edited by PartyPooper

Share this post


Link to post
Share on other sites



Hmm, the good old DOS start command has changed since I last used it. Made a slight correction to the UDF to cater for command window "titles".

Share this post


Link to post
Share on other sites
:lmao:

Once my friend told me that he had found Jesus. I thought to myself, "Woohoo, we're rich!" It turns out he meant something different.Sometimes I just like to lay in my bed and look up at the stars and wonder..where the hell did my roof go?

Share this post


Link to post
Share on other sites

Clarified the format of the version control file a little better (see first post).

Snipz, does this suit your purpose (seeing as how you're the one who encouraged me to write it :lmao:)

Share this post


Link to post
Share on other sites

Snipz, does this suit your purpose (seeing as how you're the one who encouraged me to write it ;))

Does it ever :lmao:


Once my friend told me that he had found Jesus. I thought to myself, "Woohoo, we're rich!" It turns out he meant something different.Sometimes I just like to lay in my bed and look up at the stars and wonder..where the hell did my roof go?

Share this post


Link to post
Share on other sites

Cool. I've got a few other things on my plate at the moment, but I will eventually expand the UDF to include file size and date comparision as an option (it's just compares version numbers now).

Share this post


Link to post
Share on other sites

Updated the UDF and removed the requirement for the running exe to use a different filename than the update. Makes it easier to maintain with only one exe now required on a webserver (instead of program exe and update exe).

Share this post


Link to post
Share on other sites

What does the $h_inu_LocalBatchFile - batch updater filename do? Or what do I need there? Is this something generated? Or do I need to have a batch file for updates in addition to an exe on the server?

Share this post


Link to post
Share on other sites

What does the $h_inu_LocalBatchFile - batch updater filename do? Or what do I need there? Is this something generated? Or do I need to have a batch file for updates in addition to an exe on the server?

It is an automatically generated batch file. If you don't specify anything when calling the function, it will use the default filename of "INetUpdater.bat". This filename can be changed to whatever you like by simply specifying it when calling the function.

Share this post


Link to post
Share on other sites

awesome idea.

just have a question:

if i write a script, and make it undecompilable. now i want people to be able to update this .exe file without getting the source. how would i do that? just cant figure out. thanks

Zephir

Share this post


Link to post
Share on other sites

Well, I'm not a Dev but my understanding is that even though the EXE includes the source, when you compile it and deselect "Allow decompilation", it encrypts the source with a huge random passphrase effectively making it unreadable unless you use some form of hacked decompilation tool that breaks the passphrase. Someone correct me if this is wrong.

This means, it's reasonably safe to have your program update the EXE so long as you have deselected the "Allow decompilation" field.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Updated UDF - see first post.

- Added another function option

- Added the ability to use a single control file for multiple programs

- Added "manual update required" ability

- Added some more error checking for when things go wrong

- Changed several options to allow "default" values when calling function

- Added Splashtext showing check in progress

- Fixed two minor errors in InetGetSize and InetGet calls

Edited by PartyPooper

Share this post


Link to post
Share on other sites

Udated UDF again - Fixed small error that may stop an update from occuring

Share this post


Link to post
Share on other sites

Hi.

Can you explain to a n00b how to use this? I'm having a difficult time getting "any" updater I found here to work. I need someone to dumb it down for me and explain what I do with what.

Thanks.


The SuperFlyChetGuy

Share this post


Link to post
Share on other sites

Have you written a program yet or do you have any code in which I can show you how to insert it?

Share this post


Link to post
Share on other sites

Have you written a program yet or do you have any code in which I can show you how to insert it?

What I have is a game mod that we release new versions of throughout the year. It already has a game .exe file which we update the version number using reshacker, and then we supply all the newly updated .ini and .dll files to make the changes work for the new mod release. What I need is an updater that will check the version on my website against the installed version, and then if there is a newer one online it will update automatically all the files necessary and/or prompt you to go to the website to get the latest mod. I'd like to be able to do both depending on how this works out.


The SuperFlyChetGuy

Share this post


Link to post
Share on other sites

Well, the UDF will do all that if your game mod is written in AutoIt (so it can pass the UDF the required variables), otherwise you will have to rewrite the UDF into a program that checks the properties (version number, date, etc.) of your non-AutoIt game mod.

Share this post


Link to post
Share on other sites

Well, the UDF will do all that if your game mod is written in AutoIt (so it can pass the UDF the required variables), otherwise you will have to rewrite the UDF into a program that checks the properties (version number, date, etc.) of your non-AutoIt game mod.

No way that can work this is a .exe that came from a store bought game. What I thought I could do is rename the game .exe to game.exe and then name my .exe to the original name, so when the player runs mine it will check game.exe and compare it with the one hosted on the website, if there is one new then update if not proceed to run the game. This would be a situation where the first .exe runs the second .exe for both instances, update or not.

The SuperFlyChetGuy

Share this post


Link to post
Share on other sites

:) you.

I'll try this soon.

Manadar,

I was wondering if you ever gave PartyPooper's UDF a try. It looks very promising to me and I sent PartyPooper a message with my thanks for writing and sharing with the forum. I plan on trying this on the weekend and wanted to see if you had any tips or modifications.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

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  
Followers 0