SimpleUpdater

Discuss and share scripts and script files...
Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: SimpleUpdater

Post by Marco »

There's the <nun> thing (no upgrade notice) that you can add to the titlebar template to prevent that from showing.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

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

Re: SimpleUpdater

Post by admin »

j_c_hallgren wrote:
klownboy wrote: I get the following or something similar in the title bar, "XYplorer v10.60 updated from v10.50.0023". Isn't that the case with everyone's Titlebar after an update whether it's a beta or not? I then have to go into the Help / Update Registration Details and input the serial number "key" and do a restart, and then the title bar changes to "XYplorer v11.60".
:roll: Does that "updated from x.xx.xxxx" part of title bar bother you THAT much? I barely even notice it and it's gone the next time you start XY anyway so...
It's even gone the next time you go to another folder!

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

Re: SimpleUpdater

Post by klownboy »

Ok, Ok, I give up! :lol: Sorry, I thought I had to do that to make it disappear and no it wasn't that big a deal. Wow, have I been wasting time especially when you consider all the betas. Good thing I'm retired! I never realized it went away after a restart or like the boss said just simply moving to another folder. :oops: Thanks Marco for the <nun> input in the Titlebar template. By the way, in the old days, did you need to do it? I ask only because I see the code to do that (i.e., getkey, setkey etc) in the old jackie updater script?

Thanks,
Ken

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

Re: SimpleUpdater

Post by Filehero »

Hi serendipity,

installed and ran it on my desktop machine - great addition (*)!

How about a simple message if no update could have be found, thereby the "else"-path would become GUI-responsive/unambigous as well?


Cheers,
Filehero

*: Once native XY support for zip/rar is there this script should become a standard add-on!

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

Re: SimpleUpdater

Post by serendipity »

Filehero wrote:How about a simple message if no update could have be found, thereby the "else"-path would become GUI-responsive/unambigous as well?
Sorry, did not understand. You mean if no updates (or XY upto date) there should be a message?
I already have the status message that says you have the latest version.

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

Re: SimpleUpdater

Post by Filehero »

serendipity wrote:I already have the status message that says you have the latest version.
Oh, I did miss the status message(*). Sorry for confusion!


Cheers,
Filehero

*: Was a "nightmare" evening. While installing a new video card (decided to enjoy PC-Gaming after a 10 year break) I broke the sata-plug of my system ssd hosting my Win 7. After "quickly" restoring Win 7 to another partition I realized I totally mixed up the boot file records (boot sector, boot manager - simply everything :mrgreen:). Took me hours to reactivate my Win 8 trial on my 2nd ssd.nightmare

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

Re: SimpleUpdater

Post by serendipity »

Good news!!
Seems like I can use vb script to unzip files (as far as i know all windows have vbscript.dll inbuilt).
This means the need for any third party unzipping is eliminated.

I now unzip files to a temporary location and update XYplorer. The temp file is deleted later.
Can you guys confirm if this is working??
SimpleUpdater.xys
(6.84 KiB) Downloaded 194 times

Code: Select all

//SimpleUpdater
/*
WHY SIMPLE?
1) No configuration, just copy this script to XY's scripts folder, thats it.
2) Uses the inbuilt vbscript.dll to unzip files (no 3rd party unzips required)

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 downloaded files to XY folder.
4) Restarts XY.
Notes: 
1) temp folder and vbs file is created in XY's script folder which is later deleted. (No junk left behind).
2) If you already have a temp file in xyscripts folder it will be deleted. (change the temp folder location below)
3) As before, everything works as it is, you can change paths below in "User-defined parameters" section

WHAT TO DO:
1) Copy SimpleUpdater script to XY's script folder.
2) To test paste this in address bar: ::load SimpleUpdater;

*/

//Declare global variables
    global $downloadurl,$downloadpath,$downloadfile,$newver,$temp,$vbsfile;

//Stop script if XY version is less than 09.60.0004
     end (<xyver> < "09.60.0004"), "This script needs XYplorer version 9.60.0004 or higher.";
     $ReadURL = readurl("http://www.xyplorer.com/xyfc/viewtopic.php?t=4&start=0&sd=d", , , 2);
//If no internet then script exits with a status message
     IF ($ReadURL==""){
                      status "No internet. Can't check for XY updates.","FF0000",alert;
                      end(1==1);                      
                      }  

//Read URL and get new version number and compare with current version
       $token=gettoken($ReadURL, 2, '<div class="codecontent">v'); 
       $newver =gettoken ($token, 1, " -"); 

     IF ($newver==<xyver>){
                        status "No updates, you have the latest version of XYplorer";
                        end(1==1);
                       }

     ELSE{
          Status "New XY version $newver available", "FF0000", "alert";     
         }      


//User-defined Parameters
      $downloadpath="<xyscripts>";//Path where new update will be downloaded
      $downloadfile="$downloadpath\xy.zip"; //File name of the downloaded file
      $temp="<xyscripts>\temp";            //Temporary location where unzipped contents and vbs file will be stored (and deleted thereafter)
      $vbsfile="$temp\unzip.vbs";          //VBS file location
       

//Get update info  
           $newtoken= gettoken($ReadURL, 2, 'the new BETA');  
           $downloadurl=gettoken($newtoken, 1, '" class="postlink"><span style="font-weight: bold">No-Install Package');
           $downloadurl=gettoken($downloadurl, 2, '(2) <a href="');          
           $newtoken1= gettoken($newtoken, 1, '<br /></div><br />To <span style="font-weight: bold">download');
           $newtoken2= gettoken($newtoken1, 2, 'Change Log');
           $newtoken2= gettoken(gettoken($newtoken, 1, '<br /></div><br />To <span style="font-weight: bold">download'), 2, 'Change Log');

           
  IF($newtoken2==""){
                     //Download Official release
                     $newtoken2= gettoken($newtoken1, 2, 'XYplorer Official Release');  
                     $newtoken2= gettoken($newtoken2, 1, 'faq.php" class="postlink">FAQ</a>');
                     $newtoken2= gettoken($newtoken2, 1, '<br /></div></div>');
                     $newtoken2= gettoken($newtoken2, 2, 'class="codetitle"><b>Code:</b></div><div class="codecontent">');              
                     $newtoken2="<b>Change Log:
$newtoken2";                     
                     $downloadurl="http://www.xyplorer.com/download/xyplorer_full_noinstall.zip";
                     }
  
  ELSE {
        $newtoken2= gettoken($newtoken2, 2, 'class="codetitle"><b>Code:</b></div><div class="codecontent">');
        $newtoken2="<b>Change Log for the latest XYplorer BETA version:</b>
$newtoken2";
       }

//Update window interface
  $Updatewindow=<<<Updatewindow

<style type="text/css" rel="stylesheet">
#mysubmit { background-color: #00CC00; border:0.01cm solid black; cursor= hand; font-size: 110%; font-family:Arial; color: #FFFFFF; 

height:30px;
    font-weight: bold;}
#body { background-color: #FFFFFF; border:medium none; font-size: 75%; font-family:Verdana,Arial,Helvetica;height:25px; color:#000066 }
</style>
                      <FORM NAME="UpdateXY" ACTION="xys: "><FIELDSET>
                      <Legend><INPUT TYPE=SUBMIT title="Update to v$newver" name="submit" id="mysubmit" value="Update to v$newver">
                      </Legend> 

                     <p id="body">$newtoken2</p>
                     </FIELDSET>
                     </FORM>
Updatewindow;

  $Update= html ("$Updatewindow",600,600,"Update XYplorer");
  IF ($Update Like "?submit=Update*"){
                                  sub "_downloadXY";   
                                }

   ELSE{
        status "SimpleUpdater closed", FF0000, alert;
        end(1==1);
       }


//Subscript that downloads, extracts and updates XY
"_downloadXY"
//Declare global variables
  global $downloadurl,$downloadfile,$newver,$temp,$vbsfile;
    
//If temp file already exists, it will be deleted.
   IF(exists($temp)==2){
      delete (0,0,$temp);
     }

   new ("<xyscripts>\temp","dir");
   new ("<xyscripts>\temp\extract","dir");

//Create vbs file
// Copies zip contents to temp\extract folder, then moves extracted files to XY
//Note: copying contents directly to XY is possible, but at the cost of user having to click "Yes to All" while copying.

  $VBSUnzip=<<<VBSUnzip

    ZipFile = "<xyscripts>\xy.zip"                                                      'name of zip file
    OutputFolder = "$temp\extract"                                                      'temp folder for unzipped files 
    XYFile="<xypath>"									'XYplorer path

    Set objShell = CreateObject( "Shell.Application" )
    Set objSource = objShell.NameSpace(ZipFile).Items()
    Set objTarget = objShell.NameSpace(OutputFolder)
    intOptions = 16
    objTarget.CopyHere objSource, intOptions

    Set objShell = CreateObject( "Shell.Application" )
    Set objSource = objShell.NameSpace(OutputFolder).Items()
    Set objTarget = objShell.NameSpace(XYFile)
    intOptions = 16
    objTarget.MoveHere objSource, intOptions


VBSUnzip;

     writefile("$vbsfile", "$VBSUnzip"); //Write vbs commands to file
     savesettings; //Save all settings
     download ($downloadurl,$downloadfile,o); //download latest XY
   
     substr $drive, <xypath>, 0, 2;
     substr $path, <xypath>, 2; 

//Run: Title > Text > Wait > Run vbs > Delete temp > Start XY
     run "cmd /c title SimpleUpdater && echo Updating from <xyver> to $newver... && ping -n 5 127.0.0.1 >nul && cscript //nologo ""$vbsfile"" && RD /S /Q ""$temp"" && start ""XYplorer"" $drive""$path""\<xyexe>";

     #192; //Exit XY

Last edited by serendipity on 12 Sep 2012 23:25, edited 2 times in total.

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

Re: SimpleUpdater

Post by admin »

FYI, there is a command savesettings you can use instead of #182. :)

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

Re: SimpleUpdater

Post by serendipity »

admin wrote:FYI, there is a command savesettings you can use instead of #182. :)
Thanks! Can't get easier.
BTW, is it safe to assume that all windows are vbs compliant?

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

Re: SimpleUpdater

Post by admin »

Yep.

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

Re: SimpleUpdater

Post by Marco »

@serendipity

Can you write VBS code also for closing every XY and XYcopy window after a delay?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

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

Re: SimpleUpdater

Post by admin »

serendipity wrote:
admin wrote:FYI, there is a command savesettings you can use instead of #182. :)
Thanks! Can't get easier.
I'll also add a new command Exit to get rid of those #192; ... :)

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

Re: SimpleUpdater

Post by serendipity »

admin wrote:
serendipity wrote:
admin wrote:FYI, there is a command savesettings you can use instead of #182. :)
Thanks! Can't get easier.
I'll also add a new command Exit to get rid of those #192; ... :)
Yeah, but #192 is not that bothersome.

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

Re: SimpleUpdater

Post by serendipity »

Marco wrote:@serendipity

Can you write VBS code also for closing every XY and XYcopy window after a delay?
Close or kill??

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

Re: SimpleUpdater

Post by Marco »

serendipity wrote:
Marco wrote:@serendipity

Can you write VBS code also for closing every XY and XYcopy window after a delay?
Close or kill??
Close. There should be a way to focus a window and then send an Alt+F4, but never investigated further...
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Post Reply