Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[Func] Self script updater


  • Please log in to reply
69 replies to this topic
Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010
It would be rather easy to impliment but i'd rather not add extra stuff into the function unless people really want it. I've seen to many good functions get bogged down with so much extra stuff nobody uses (or atleast I haven't seen use) and it just sacres off people who might otherwise want to try out the code.


For now you could set it up yourself as follows.


1. Add an extra key in the version.ini file that points to your update changes
2. In the check_ForUpdate() function where it download the new file add in a 2nd iniread and urldownloadtofile to download the version info
3. in the "switch to new script" section append that data to a .txt file and run it - which will launch it

jpjazzy
  • Members
  • 800 posts
  • Last active: Dec 17 2014 07:22 AM
  • Joined: 16 Feb 2010
Why download it a second time rather than just reading it? I figured you could just add another string in the INI to make it function and omit it (like the MD5) when it isn't needed. It's not necessary though, just a thought. :)
AutoHotkey Basic - Windows 7
Posted Image

Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010
I had that thought at first, but if you want a multi line field a ini key wont be nice.

Also, download it a 2nd time? I would never do that :p i'm a VERY optimized kind of guy. What did you mean by that?

jpjazzy
  • Members
  • 800 posts
  • Last active: Dec 17 2014 07:22 AM
  • Joined: 16 Feb 2010

2nd iniread and urldownloadtofile


Was just reading that part and must have misinterpreted.
A separate INI read wouldn't be an issue I think.
AutoHotkey Basic - Windows 7
Posted Image

Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010

2nd iniread and urldownloadtofile


Was just reading that part and must have misinterpreted.
A separate INI read wouldn't be an issue I think.



Ah :)

Also, check out my M&K counter script if you feel like it :) any comments/suggestions about it would be awesome. (link in signature)

jpjazzy
  • Members
  • 800 posts
  • Last active: Dec 17 2014 07:22 AM
  • Joined: 16 Feb 2010
I am heading to bed for now, but I will have a look tomorrow at it. Good night and thanks for the response.
AutoHotkey Basic - Windows 7
Posted Image

poserpro
  • Members
  • 525 posts
  • Last active: Apr 28 2013 04:39 AM
  • Joined: 21 Oct 2010
Great Script, will be cool it is also can do a Traytip version, so users won't be interrupted while working in the main view.

Since Oct 11, 2010

Check my QRCode design if you wish: 

http://db.tt/CONU2zBY


Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010
All you've got to do is switch the msgboxs to traytips if you want a traytip version.

iDrug
  • Members
  • 389 posts
  • Last active: Oct 11 2015 09:24 PM
  • Joined: 13 Oct 2009
It's awesome, but is it possible to make it work without storing any data in any external files like *.ini?
Why can't that kind of info be stored inside of the script's code itself?

and one more question: I haven't yet tried it, but does the suggested function works for the compiled (ahk2exe) scripts?

Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010

It's awesome, but is it possible to make it work without storing any data in any external files like *.ini?
Why can't that kind of info be stored inside of the script's code itself?

and one more question: I haven't yet tried it, but does the suggested function works for the compiled (ahk2exe) scripts?



The external ini is needed so the script knows if it should download the file or not (is it a newer one?)


The function will work with compiled scripts (ahk2exe).

Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010
Updated to 1.5

Fixed compatibility with x64 AHK_L
Fixed (hopefully) a rare instance where the function would not kill the existing script

Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010
Updated to 1.6

Fixed a typo that would cause the script to crash if the line ever got executed

Rseding91
  • Members
  • 703 posts
  • Last active: Apr 02 2016 05:05 AM
  • Joined: 07 Jun 2010
Updated to 1.7

Fixed a problem when the computer is bogged down the function would not kill the existing script causing #SingleInstance errors

Maestr0
  • Members
  • 652 posts
  • Last active: Jan 04 2019 04:01 PM
  • Joined: 18 Oct 2008
Very cool!
Did someone combine this script with URLGet yet? (<!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?t=77176">viewtopic.php?t=77176</a><!-- l -->)
Would be very cool if it had a GUI with information like that, no?

iDrug
  • Members
  • 389 posts
  • Last active: Oct 11 2015 09:24 PM
  • Joined: 13 Oct 2009

It's awesome, but is it possible to make it work without storing any data in any external files like *.ini?
Why can't that kind of info be stored inside of the script's code itself?

The external ini is needed so the script knows if it should download the file or not (is it a newer one?)

Yeah, but why use an external file to store that info?
You could make the script work so:
1. It connects to the server via provided URL and reads the *.ini-file from the server.
2. Runs a comparison of the version stored in the *.ini-file and in the version in the code of the local script (*.ahk or *.exe).
3. If the server has a newer version of the script - download it and replace the existing one with it.

I mean why do you make users have an *.ini file locally? Can't the script read it's own code?
To do what I mean - users would just have to have the script's version stored in the code of the script and separately in the *.ini file (in order to reduce traffic consumption and download only lightweight *.ini at every check, instead of probably heavy *.exe/*.ahk).
That would be nice, since some scripts do work without any external *.ini-files (yeah, I like super-mega portability, when you need to copy only the executable).