Re: SimpleUpdater
Posted: 11 Sep 2012 17:24
There's the <nun> thing (no upgrade notice) that you can add to the titlebar template to prevent that from showing.
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
It's even gone the next time you go to another folder!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".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...
Sorry, did not understand. You mean if no updates (or XY upto date) there should be a message?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?
Oh, I did miss the status message(*). Sorry for confusion!serendipity wrote:I already have the status message that says you have the latest version.
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
Thanks! Can't get easier.admin wrote:FYI, there is a command savesettings you can use instead of #182.
I'll also add a new command Exit to get rid of those #192; ...serendipity wrote:Thanks! Can't get easier.admin wrote:FYI, there is a command savesettings you can use instead of #182.
Yeah, but #192 is not that bothersome.admin wrote:I'll also add a new command Exit to get rid of those #192; ...serendipity wrote:Thanks! Can't get easier.admin wrote:FYI, there is a command savesettings you can use instead of #182.
Close or kill??Marco wrote:@serendipity
Can you write VBS code also for closing every XY and XYcopy window after a delay?
Close. There should be a way to focus a window and then send an Alt+F4, but never investigated further...serendipity wrote:Close or kill??Marco wrote:@serendipity
Can you write VBS code also for closing every XY and XYcopy window after a delay?