Mero's Script Updater & Launcher

Post your working scripts, libraries and tools
User avatar
mero
Posts: 6
Joined: 20 Aug 2017, 14:54

Mero's Script Updater & Launcher

10 Sep 2017, 12:39

Launcher.AHK:

Code: Select all

IniRead,Current_ini,version.ini,Info,Version,N/A  ;This is the desktop version.ini which will be compared with the online version.ini. It assumes that the version.ini is in the same directory unless specified otherwise.
Update_URL := "your version.ini download link" ;The URL of the online version.ini file for your script
	
Random,Filler,10000000,99999999
	, Version_File := A_Temp . "\" . Filler . ".ini"
	, Temp_Exe := A_Temp . "\" . f . "yourfilename.exe" ;replace yourfilename.exe with your desired program name. 

UrlDownloadToFile,%Update_URL%,%Version_File%
IniRead,Version,%Version_File%,Info,Version,N/A
If (Version = "N/A"){
			FileDelete,%Version_File%

			
		}
If (Version > Current_ini)
{
		IniRead,URL,%Version_File%,Info,URL,N/A
		UrlDownloadToFile, %url%, %Temp_Exe%
		Run, %Temp_Exe%
		UrlDownloadToFile,%Update_URL%,version.ini ;this makes the newer version.ini replace the current version.ini on your desktop. It assumes that the version.ini is in the same directory unless specified otherwise. Make sure this matches the location of the old version.ini
		exitapp
}
	Else
{
IfExist, %Temp_Exe%
{
	FileDelete,%Version_File%
	Run, %Temp_Exe%
}
IfNotExist, %Temp_Exe%
{	
Msgbox, File not found. Downloading. ;you can remove this line if you don't want the message box.
	UrlDownloadToFile,%Update_URL%,%Version_File%
	IniRead,URL,%Version_File%,Info,URL,N/A
	UrlDownloadToFile, %url%, %Temp_Exe%
	FileDelete,%Version_File%
	Run, %Temp_Exe%
}
exitapp
}

exitapp
Description:
This beginner-friendly program will automatically check for updates and launch the latest version of your program. I wanted to create a simplified/modified alternative to Rseding91's self script updater(because I am too trash to actually get his working).

How to set up:
1.Upload your newest compiled program to dropbox or google drive
2.Copy the direct download link for your program.
3.Create a file called version.ini and input the following

Code: Select all

[Info]
Version=1.0
URL=Input your direct .exe download link
4.Save a copy of the version.ini in a folder and another copy in your Dropbox/Google Drive
5.Copy my launcher script into an .AHK file and put it in the same folder as version.ini
Your folder should look like this:
Image
6.Get the direct download link for your version.ini
7.Replace the part of the Launcher script called "your version.ini download link". Keep the download link in quotation marks.
Example:
Update_URL := "https://dl.dropboxusercontent.com/s/111111111111/randomdownloadinfostuff"
8.Replace "yourfilename.exe" with your desired program name. Keep the download name in quotation marks.
Example:
, Temp_Exe := A_Temp . "\" . f . "New_Program.exe"
9.You are all done. Save and compile your new launcher. :dance:

How to push out an update:
1.Drag your newly updated program into your Dropbox/Google Drive and overwrite the old version
2.Edit the version.ini in your Dropbox/Google Drive and increase the version number from Version=1.0 to Version=2.0.
3.Run the launcher program on your desktop. The program will see that the version number in your Dropbox/Google Drive is larger and automatically update.

Where does the launcher put my downloaded program?:
This script saves your New_Program.exe to the Temp folder. You can find the Temp folder by putting %temp% in your Window's search bar or run command.

How it works:
Spoiler
Image
ln7o
Posts: 15
Joined: 01 Dec 2015, 22:12

Re: Mero's Script Updater & Launcher

21 Jan 2018, 23:04

How it make it work on LAN network?
Elendiar
Posts: 13
Joined: 03 Jul 2018, 05:44

Re: Mero's Script Updater & Launcher

07 Jul 2018, 02:37

I also need self updater for my script, that will be deployed on ~150 pc. Idea with .ini file is great, and for LAN think must replace UrlDownloadToFile with a FileCopy. Updater compile to .exe and in script place Settimer to call updater that make all job of replacing. But i dont need temp folder, script is in startup user folder.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: arcticir, pedroabs and 24 guests