SimpleUpdater

Discuss and share scripts and script files...
Post Reply
serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

SimpleUpdater

Post by serendipity »

UPDATE:
Please use the newer, faster and better version of the script.
Link: http://www.xyplorer.com/xyfc/viewtopic. ... 990#p77990

Hi all,
I know there are already few XY updaters around, but I wanted to have a simple solution without any configuration whatsover.
NOTE: You have to download a free unzip.exe (200KB) for this. If you don't like to do this, then this script is not for you.

WHY SIMPLE?
No configuration, just copy two files to XY's scripts folder, thats it.

HOW IT WORKS:
1) Checks for beta or official release and shows the change log and an option to update.
2) Saves current configuration.
3) Downloads the XY zip file to scripts folder, closes XY (your config is saved already) and extracts downlaoded files to XY folder.
4) Restarts XY.
5) If you are upto date status bar says so.

WHAT TO DO:
1) Copy attached files SimpleUpdater.xys and unzip.exe (direct link: http://stahlforce.com/dev/unzip.exe) to XY's script folder.
2) To test paste this in address bar: ::load SimpleUpdater;

Attachments:
SimpleUpdater.xys
(4.92 KiB) Downloaded 284 times
unzip.zip
(96.05 KiB) Downloaded 231 times
(extract unzip.exe file)

Update:
Update: Forgot to include url for official release of XY.

Note: This script works as it is, but if you prefer you can define your own paths for download and unzip file in the section User defined parameters in the script.

Credits: Jacky (Used one line from his updater script )
Last edited by serendipity on 15 Oct 2012 17:24, edited 7 times in total.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: SimpleUpdater

Post by serendipity »

Tip:
Right-click XY shortcut>Properties and add this switch towards the end of target field:

Code: Select all

 /script=SimpleUpdater
On startup XY will check for updates. 8)

nas8e9
Posts: 2232
Joined: 21 Jun 2008 14:50

Re: SimpleUpdater

Post by nas8e9 »

Thank you for your script! I'm curious about how you check for a new version; if I understand correctly, you're relying for both release and beta versions, on parsing the (sorted by date) beta change log page to extract the "top"-most version number?

One possible snag, is that I seem to recall Don not always including new release versions in the beta changelog, although checking programatically for the last release version is easy (the built-in update check handles only release versions), while in practical terms betas are much more common than release versions.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: SimpleUpdater

Post by serendipity »

nas8e9 wrote:Thank you for your script! I'm curious about how you check for a new version; if I understand correctly, you're relying for both release and beta versions, on parsing the (sorted by date) beta change log page to extract the "top"-most version number?

One possible snag, is that I seem to recall Don not always including new release versions in the beta changelog, although checking programatically for the last release version is easy (the built-in update check handles only release versions), while in practical terms betas are much more common than release versions.
I use this link to get my info.
As far as I've known, info about beta and official release always appear in this page.
For example in the above link, first post on the 2nd page has info about new official release.

nas8e9
Posts: 2232
Joined: 21 Jun 2008 14:50

Re: SimpleUpdater

Post by nas8e9 »

serendipity wrote:
nas8e9 wrote:Thank you for your script! I'm curious about how you check for a new version; if I understand correctly, you're relying for both release and beta versions, on parsing the (sorted by date) beta change log page to extract the "top"-most version number?

One possible snag, is that I seem to recall Don not always including new release versions in the beta changelog, although checking programatically for the last release version is easy (the built-in update check handles only release versions), while in practical terms betas are much more common than release versions.
I use this link to get my info.
As far as I've known, info about beta and official release always appear in this page.
For example in the above link, first post on the 2nd page has info about new official release.
Thank you for the info. You're right that the last release version is on that list; I use that same forum to stay up-to-date myself, and I seem to recall seeing a release announced on the RSS-feed of major download sites but not the beta forum.

@Don: To get a canonical answer: should release versions always show up as posts in the beta forum too?

avsfan
Posts: 554
Joined: 29 Jun 2006 09:00
Location: Fort Collins, Colorado

Re: SimpleUpdater

Post by avsfan »

This is great -- Thanks a bunch!

One change that I made (since I like to keep older versions around) is to change a small block of code in the middle from

Code: Select all

//User defined Parameters
      $unzippath="<xyscripts>\unzip.exe"; //Path for unzip.exe
      $downloadpath="<xyscripts>";//Path where new update will be downloaded
      $downloadfile="$downloadpath\xy.zip"; //File name of the downloaded file

      $xypath=<xypath>;//XYplorer path

     $token=gettoken($ReadURL, 2, '<div class="codecontent">v');
     $newver =gettoken ($token, 1, " -");
     $xyver=<xyver>;
to

Code: Select all

//User defined Parameters
      $unzippath="<xyscripts>\unzip.exe"; //Path for unzip.exe
      $downloadpath="<xyscripts>";//Path where new update will be downloaded
      $xypath=<xypath>;//XYplorer path

     $token=gettoken($ReadURL, 2, '<div class="codecontent">v');
     $newver =gettoken ($token, 1, " -");
     $downloadfile="$downloadpath\xyplorer_" . $newver . "_noinstall.zip"; //File name of the downloaded file
     $xyver=<xyver>;
The change is moving the line where the name for $downloadfile is specified to after the $newver is assigned so that the name of the downloaded file will have the version number included.

A simple change, but one that works well for me.

Enjoy! (and thanks again, serendipity!)

andy

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: SimpleUpdater

Post by serendipity »

avsfan wrote:One change that I made ....
andy
Yes, one can change a lot of things to their liking (especially paths), but i kept the filename to simply xy.zip so that old betas don't accumulate in scripts folder.
And glad you like it, enjoy. :)

klownboy
Posts: 4397
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: SimpleUpdater

Post by klownboy »

Hey serendipity, very nice script. It worked fine for me. However, I noticed when the script finished, I was left with the XY title bar having the new beta (10.50.0023) version updated from bla, bla, bla (I had the previous beta) as it normally does before you do a restart. I looked a bit closer at the code and you have #192 command at the tail end, doesn't that perform a exit (alt-F4) as opposed to #190 which is restart (without saving). I also noticed you did a save before that point, but I think I will comment the #182 out in-case I 've done somethiing I don't want saved before the update.
Thanks again,
Ken

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: SimpleUpdater

Post by serendipity »

klownboy wrote:Hey serendipity, very nice script. It worked fine for me. However, I noticed when the script finished, I was left with the XY title bar having the new beta (10.50.0023) version updated from bla, bla, bla (I had the previous beta) as it normally does before you do a restart. I looked a bit closer at the code and you have #192 command at the tail end, doesn't that perform a exit (alt-F4) as opposed to #190 which is restart (without saving). I also noticed you did a save before that point, but I think I will comment the #182 out in-case I 've done somethiing I don't want saved before the update.
Thanks again,
Ken
Well, XY has to exit (not restart) because the CMD has to copy files to XY which is not possible if XY is still running. Once the copy is complete XY is started from within CMD so #190 (restart without saving) is not what I need here.
If you dont want to save setting, comment out #182 and use #191 (exit without saving) instead of #192.
Hope that helps.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: SimpleUpdater

Post by Marco »

Nice script!
How does it cope with multiple/concurrent XY instances?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Filehero
Posts: 2713
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: SimpleUpdater

Post by Filehero »

Hi serendipity,

does what it's supposed to do and a clever and compact implementation -> Great!!

Thanks a lot for this nice work. :)


Cheers,
Filehero

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: SimpleUpdater

Post by serendipity »

Marco wrote:Nice script!
How does it cope with multiple/concurrent XY instances?
I did not consider that when i made the script. So right now the script closes the current instance of XY and does not update anything since XY is still open. The closed instance remains closed.
One solution is to exit the XY that is running the script and use taskkill to kill all other XY instances (settings of only one XY instance are saved, rest you lose). This is not a problem if all instances belong to same config, problem is if those XY instances belong to different configs.
So it's not nice to kill an unsaved XY instance (unless its from the same config).

@Don: is there a way to save settings of all XY instances?

Filehero
Posts: 2713
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: SimpleUpdater

Post by Filehero »

Hi,

when I ran the script some couple of minutes ago, I ended up with 11.50.0023 as the current version. Later on, I saw the official release 11.60 is out. Rerunning the script did not detect it, which is because it's not listed where you look.


Cheers,
Filehero

admin
Site Admin
Posts: 64835
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SimpleUpdater

Post by admin »

Filehero wrote:Hi,

when I ran the script some couple of minutes ago, I ended up with 11.50.0023 as the current version. Later on, I saw the official release 11.60 is out. Rerunning the script did not detect it, which is because it's not listed where you look.


Cheers,
Filehero
My fault, I was too lazy today... :) ... will add now... :whistle:

Filehero
Posts: 2713
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: SimpleUpdater

Post by Filehero »

admin wrote:My fault, I was too lazy today... :) ... will add now... :whistle:
how about an auto-update script?

:mrgreen:

Post Reply