ideas for a auto updating app

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
jsong55
Posts: 263
Joined: 30 Mar 2021, 22:02

ideas for a auto updating app

02 Apr 2024, 09:50

Whenever, user runs it, uses something like URLDownloadToVar to get a JSON with newest version, check current version. Download new exe file reload and delete old?
User avatar
mikeyww
Posts: 27363
Joined: 09 Sep 2014, 18:38

Re: ideas for a auto updating app

02 Apr 2024, 11:13

I would go ahead and give it a whirl. It looks like you already know what to do and what functions to use. Post your script and your other file if you get stuck.
jsong55
Posts: 263
Joined: 30 Mar 2021, 22:02

Re: ideas for a auto updating app

02 Apr 2024, 23:44

Kind of was looking forward to someone to point me to an existing library. But I couldn't find one on the forum.
User avatar
boiler
Posts: 17375
Joined: 21 Dec 2014, 02:44

Re: ideas for a auto updating app

03 Apr 2024, 02:17

In case you don’t have this yet:

Code: Select all

URLDownloadToVar(url) {
	whr := ComObject('WinHttp.WinHttpRequest.5.1')
	whr.Open('GET', url)
	whr.Send()
	whr.WaitForResponse()
	return whr.ResponseText
}

And I’ve seen that you already use thqby’s JSON library. So I guess you’re looking for everything put together. It’s really straightforward. No library needed. Just do those things as you described. It’s just a handful of lines.

I happen to have been working on this very thing. One problem I ran into was replacing the existing file while it’s running (I need it to be a compiled .exe file), and it wouldn’t allow that because the .exe file is in use. I don’t think it would do that with a .ahk file, so if that’s what you’re using, it should not be an issue. In my case, I will just need to launch another .exe, exit the current one, and have the other .exe replace the first one and relaunch it.
jsong55
Posts: 263
Joined: 30 Mar 2021, 22:02

Re: ideas for a auto updating app

03 Apr 2024, 03:10

@boiler
We would want to let the user choose whether to update the app and also to revert to a previous version... If needed.

So the installer exe will need to ask the user if they wish to update and download the new version if so.

I would use the command line 7z app to extract the password protected download so no one monitoring the network can sniff the files

Thinking it through before even writing a line
jsong55
Posts: 263
Joined: 30 Mar 2021, 22:02

Re: ideas for a auto updating app

04 Apr 2024, 09:16

It ended up less straight forward than a few lines of code... But I pushed to production.

Main App needs to write version number to text file, then call updater.
Updater checks version by downloading json and prompts user. If current version = exit
If yes proceed else exit.
Then processclose main app and downloads new, unpacks, deletes package run new app

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Draken, just me and 22 guests