Basic features
maintains (n, user choice) backups of main XY files and script folder
checks XY web site to get base current version & downloads update
unzip, update and re -load XY
see notes in script for other details
Code: Select all
"script to update XYPlorer to latest version"
msg "update XYPlorer version",1;
// see notes below
// save current exe,ini & dat files + scripts to Backup folder and rename with date
#182;
status "Backup current exe,ini&dat files + script files";
copyto "<xypath>\Backup\v<xyver> (on <date yyyy.mm.dd_hh-nn-ss>)", "<xypath>\XYplorer.exe|<xydata>\*.ini|<xydata>\*.dat|<xydata>\scripts";
goto "<xypath>\Backup";
// get number of backups to keep (default 5), delete oldest if more
input $nobu , "Total number of backups to keep", 5;
focus l;
sel a;
$selcnt=getinfo("CountSelected");
$notodelete = eval("$selcnt - $nobu"); // compute nomber of oldest to delete
copytext $notodelete; // store result
$test = $selcnt > $nobu? "more": "less"; // test if any to delete
sub "_"."$test";
// more - delete oldest backup(s) and then get latest update
"_more"
set $notodelete, <clipboard>; // retrieve number to delete
#485; // refresh list
sel a;
sel +, $notodelete;
delete 1, 0, ":list";
#485; // refresh list
sel 1; // display oldest backup
msg "5 Backups stored, oldest : <curname>, OK to download latest version?";
sub _getnew;
"_less" // less - no old backups to delete, get latest update
sel 1; // display oldest backup
msg "Oldest Backup stored, : <curname>, OK to download latest version?";
sub _getnew;
"_getnew"; // get latest version for beta down load
// create or clear temp dir & download latest version XY to temp dir
// extract files in temp dir & copy to update XY using bat file
// check for latest version of beta
status "Checking for latest version at www.XYplorer.com";
internetflags "INTERNET_FLAG_NO_COOKIES", 1;
readurl $a, "http://www.xyplorer.com/vercheck.php?version=?";
strpos $pos, $a, "0000",0;
incr $vpos,$pos,-5;
substr $v, $a, $vpos, 4; //get just the main version number
msg "Latest XYplorer base version is $v, Continue to update using this base version ",1;
// create or clear temp dir
copyto "<xypath>\XYtemp", "<xypath>\xyplorer.ini"; // create new C:\Program Files\XYplorer\XYtemp folder if needed
goto "<xypath>\XYtemp";
focus l;
sel a;
delete 1, 0, ":list"; //clear files from temp folder
wait 500;
// download latest version
download "http://www.xyplorer.com/download/xyplorer_".$v."_beta_noinstall.zip", "<xypath>\XYtemp",o;
wait 1000;
goto "<xypath>\XYtemp";
focus l;
sel 1;
rename , "xylatest";
// extract new files
run '"C:\program files\7-zip\7z" e -y "c:\Program Files\XYplorer\XYtemp \xylatest.zip" -o"c:\Program Files\XYplorer\XYtemp"';
goto "<xypath>\XYtemp";
msg "Latest version download stored in <xypath>\XYtemp if needed, continue update to latest version",1;
//using bat file, update XYPlorer.exe, .hlp .tipoftheday.htm files & restart XYplorer
open "<xypath>\update XYplorer.bat";
//end script
/* notes
to run this script it must be <xypath>\scripts dir
the path used throughout is C:\ (change this as required in the script)
the script creates and uses a temp file (<xypath>/XYtemp) for the current down load which is retained
Backups of XY are made and stored in <xypath>/Backup, user choice on number of back ups
Latest beta version checks XY site to get the base version before download
extract files in script uses 7-zip, change if other
update of xy files done using external .bat file (change as reqd. note TSKILL is for XPWIN Home)
.bat file (filed in <xypath> dir
cd windows\system32
TSKILL XYPlorer /a /v
echo .
pause
copy "C:\Program Files\XYplorer\XYtemp\XYplorer.hlp" "C:\Program Files\xyplorer\" /y
copy "C:\Program Files\XYplorer\XYtemp\TipOfTheDay.htm" "C:\Program Files\xyplorer\" /y
copy "C:\Program Files\XYplorer\XYtemp\XYplorer.exe" "C:\Program Files\xyplorer\" /y
cd \
cd "program files\xyplorer"
START XYplorer.exe
*/
XYplorer Beta Club