1) Now, if there is no connection to the internet, script quietly exits with status message.
2) Script won't work if version less than 9.60.0004.
Checks for updates on startup. See description below:
Code: Select all
//UpdateXYonStart
//This script will automatically check for new version of XY on startup.
//But to actually do the updates, you have to use one of the update scripts available from script exchange section.
//Optionally you can also add backup script before doing the updates.
//See sections //#1 and //#2 below for update and backup script suggestions.
////HOW TO MAKE XY LOOK FOR UPDATES ON STARTUP:
//(a) Copy this script and save it inside XY's script folder.
//(b) Save your current running XY (File>Settings>Save Configuration)
//(c) Create a shortcut (File>Settings>Create Shortcut to this Configuration...). Shortcut is created on Desktop. If you already have a XY shortcut on desktop then skip this step.
//(d) Exit XYplorer (File>Exit)
//(e) Right-click on your XY shortcut and click on properties.
//(f) The target field looks like this: "C:\Program Files\XYplorer\XYplorer.exe" /ini="XYplorer"
//(g) Change it to this: "C:\Program Files (x86)\XYplorer\XYplorer.exe" /script=UpdateXYonStart /ini="XYplorer" and "Apply" and "OK"
//(h) Double-click on the shortcut, XY will open and the script UpdateXYonStart.xys will laod and check for updates.
//Stop script if XY version is less than 9.60.0004
end (<xyver> < "9.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", , , 1);
//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);
}
$token=gettoken($ReadURL, 2, '<div class="codecontent">v');
$token =gettoken ($token, 1, " -");
$xyver=<xyver>;
IF ($token==$xyver){
status "You have the latest version XYplorer";
//end(1==1);
}
ELSE{
$Updatewindow=<<<Updatewindow
<style type="text/css" rel="stylesheet">
#mysubmit { background-color: #cfc; border:medium none; cursor= hand; font-size: 70%; font-family:Verdana,Arial,Helvetica;height:25px;
font-weight: bold; }
</style>
<center>
<TABLE border=0>
<TR>
<TD align="middle">
<FORM NAME="UpdateXY" ACTION="xys: "><FIELDSET>
<Legend><font face="verdana"><font size="-1">Version <font color="red">$token</font> available:</font></font></Legend><BR>
<INPUT TYPE=SUBMIT title="Update to v$token (without backing up current XYplorer)" name="submit" id="mysubmit" value="Update"><BR><BR>
<INPUT TYPE=SUBMIT title="Back up XYplorer and update to v$token" name="submit" id="mysubmit" value="Backup and Update">
</FIELDSET>
</FORM>
</TD>
</TR>
</TABLE></center>
Updatewindow;
$Update = urldecode (html("$Updatewindow", 200, 260, "Update XYplorer"));
IF($Update==""){
status "Script closed", FF0000, alert;
end(1==1);
}
ELSEIF ($Update=="?submit=Update"){
//#1 Insert a XYupdater script below. Suggestion: Jacky's XYplorer Automatic Updater script.
//You need two things for this: A) The script itself from here: http://www.xyplorer.com/xyfc/viewtopic.php?p=26196#p26196
// B) A dependency, common-jacky from here: http://www.xyplorer.com/xyfc/viewtopic.php?p=26196#p26196
// Download and place the .xys files inside XY's script folder. Below line calls Jacky's script
load "XYplorer Automatic Updater";
}
ELSE{
//#2 Insert your backup script below. Suggestion: Don updated Jacky's backup script, download from here: http://www.xyplorer.com/xyfc/viewtopic.php?p=33983#p33983
//Save the script as BackupXY.xys inside XY's script folder. Below line calls the backup script
load "BackupXY.xys";
wait (5000);
//Same as //#1 above
load "XYplorer Automatic Updater";
}
}
For updating you need: For Backing up XY you need:
XYplorer Beta Club