Script updater

Post your working scripts, libraries and tools
SkrillexAkaCraft
Posts: 119
Joined: 25 Dec 2015, 10:01

Script updater

26 Jun 2017, 21:37

After struggling for a long time finding myself a way to push updates i finally came with a solution


so here it is

Code: Select all

Name = Your File Name


UrlDownloadToFile, (Urltoyourupdate.txt), path to where it should download the file\Update.txt
FileRead, text, path to where your file is located\Update.txt
if InStr(text, "Pinda") ;Change "Pinda" to a new word after you are going to push a update change your txt file to text="YourWord"
{
		Gui, Update:Add, Text, x5 y40 w145 h25, You are currently running an outaded version       ;Announces the current version the user is using.
		Gui, Update:Add, Text, x5 y85 w125 h15, Would you like to update?         ;Text asking if the user wants to update to the newer version
		Gui, Update:Add, Button, x85 y180 w43 h23 gYes, Yes                        ;If pressed it will go to the Yes sub to download the newest version available;
		Gui, Update:Add, Button, x135 y180 w43 h23 gHome, No                     ;Will skip the update and go to the main functions
		Gui, Update:Show, w192 h204, Update?                                     ;Update window title.
	}
else
{
 "Add your new functions here"
}



Yes:
UrlDownloadToFile, www.yoururl.com, your path & File name
gosub Run
return


Run:
Run, %Name%
ExitApp


this is how the file you have to upload should look like "Remove the quotes!"

Code: Select all

text="Your word"

now everytime you want to push a update change text="Your Word" to a new word else your script will keep saying that there is a update!






Test it here:
Spoiler
ozzii
Posts: 322
Joined: 30 Oct 2013, 06:04

Re: Script updater

27 Jun 2017, 04:21

If I may, maybe use something like so you don't have to download the version file. In that way you don't have to delete the file and do a read of that file.

Code: Select all

AA:= URLDownloadToVar("https://raw.githubusercontent.com/SkrillexAkaCraft/FiestaOnline/master/Update.txt")
msgbox % AA

URLDownloadToVar(url) {
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.Open("GET", url)
 WebRequest.Send()
 Return, WebRequest.ResponseText
}
Justusingthisforasec

Re: Script updater

27 Jun 2017, 05:48

ozzii wrote:If I may, maybe use something like so you don't have to download the version file. In that way you don't have to delete the file and do a read of that file.

Code: Select all

AA:= URLDownloadToVar("https://raw.githubusercontent.com/SkrillexAkaCraft/FiestaOnline/master/Update.txt")
msgbox % AA

URLDownloadToVar(url) {
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.Open("GET", url)
 WebRequest.Send()
 Return, WebRequest.ResponseText
}

I will see what i can do i just use this as a basic solution since i did not find any other working self script updater
Justusingthisforasec

Re: Script updater

27 Jun 2017, 05:48

ozzii wrote:If I may, maybe use something like so you don't have to download the version file. In that way you don't have to delete the file and do a read of that file.

Code: Select all

AA:= URLDownloadToVar("https://raw.githubusercontent.com/SkrillexAkaCraft/FiestaOnline/master/Update.txt")
msgbox % AA

URLDownloadToVar(url) {
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.Open("GET", url)
 WebRequest.Send()
 Return, WebRequest.ResponseText
}

I will see what i can do i just use this as a basic solution since i did not find any other working self script updater
User avatar
Tomer
Posts: 282
Joined: 21 Aug 2016, 05:11

Re: Script updater

27 Jun 2017, 16:00

Tnx

Return to “Scripts and Functions”

Who is online

Users browsing this forum: hasantr, JnLlnd, PENpal, robodesign, SpeedMaster, SupposedToBeWorking and 42 guests