Page 1 of 1

SU Helper

Posted: 05 Jun 2013 21:12
by serendipity
SU_Helper
This script works together with SimpleUpdater script (hereafter referred to as SU).
So first make sure you have set that script right.
Credits go to Marco for maintaining the SU script so well. :)

WHAT THIS SCRIPT DOES?
The script gives a visual feedback(button change in toolbar) and optionally a sound feedback
if a new XY version is available.
It's most useful if you call this script when XY starts.
Check D. in "How to set it up" below.

HOW IT WORKS?
The script reads the SU script file, stores the script in memory,
adds some more code to the stored script on-the-fly and loads the script from memory.
Note: This script does *not* make any changes to the original SU script file.
But make sure you have the correct version. See A below.

HOW TO SET IT UP?
Ofcourse, you need this script itself which should be inside XY's script folder.
SU_Helper.xys
Then follow below instructions:

A. Make sure you have this version of SU: Rev. 10.66 / 2013/04/24
Link: http://www.xyplorer.com/xyfc/viewtopic. ... 990#p77990

B. Setup a button in the toolbar and note down the button index (see code below). Follow above link and go to Tips section to set it up.
C. Read User Settings #1 to #5 below carefully and change them accordingly

optional
D. You can call this script when XYplorer starts. Right-click on the XY shortcut and
paste below code towards the end in the target field:

Code: Select all

   /script="::load 'SU_Helper.xys';"

If sufficient people are interested it will be incorporated directly in the main SimpleUpdater script.

Code: Select all

/*
[size=150][u]SU_Helper[/u][/size]
This script works together with SimpleUpdater script (hereafter referred to as SU). 
So first make sure you have set that script right.
Credits go to Marco for maintaining the SU script so well. :)

WHAT THIS SCRIPT DOES?
The script gives a visual feedback(button change in toolbar) and optionally a sound feedback
if a new XY version is available.
It's most useful if you call this script when XY starts. Check D. in "How to set it up" below.

HOW IT WORKS?
The script reads the SU script file, stores the script in memory, 
adds some more code to the stored script on-the-fly and loads the script from memory.   
Note: This script does *not* make any changes to the original SU script file.
      But make sure you have the correct version. See A below. 
          
HOW TO SET IT UP?
Ofcourse, you need this script itself which should be inside XY's script folder. Then follow below instructions:

A. Make sure you have this version of SU: Rev. 10.66 / 2013/04/24
   Link: http://www.xyplorer.com/xyfc/viewtopic.php?p=77990#p77990
   
B. Setup a button in the toolbar and note down the button index (see below). Follow above link and go to Tips section to set it up.
C. Read User Settings #1 to #5 below carefully and change them accordingly

optional
D. You can call this script when XYplorer starts. Right-click on the XY shortcut and
   paste below code towards the end in the target field:
   /script="::load 'SU_Helper.xys';"
*/
//USER SETTINGS:

/*
#1. SU path (default is "<xyscripts>\SimpleUpdater.xys")
*/
   $SU_File="<xyscripts>\SimpleUpdater.xys"; 
   
/*
#2. Icon when XY is already Up-to-date
    > If icon is inside XYplorer's icon folder then no path is required, else specify path.
    > You can simply use XY's internal buttons such as :back and :fore for #2 and #3 respectively
*/
   $icon1="su1.ico"; 
   
/*
#3. Icon when an update is available
    > Other details same as above
*/
   $icon2="su2.ico"; 
   
/*
#4. Index of the button you placed on the Toolbar. 
    How to find the index?
    > Right-click the button, click "Customize toolbar..."
    > Next to your button label if you see something like [ctb9] your index is 9.
*/
   $buttonindex=9;

/*
#5. Sound file you want to use if update is available
    > Specify the path of the sound file
    > If you dont want sound, leave it empty like this ""
*/
   $updatesound="<xyscripts>\su.wav";





//!!!!!!!! DON'T CHANGE ANYTHING BEYOND THIS !!!!!!!!!!!! 

/*Read SU file */       
    $SU_Orig=readfile("$SU_File");

/*Set values to strings and new strings   */
   $string1=<<<string1
 global $last_modified, $delay, $channel, $major_changelog, $beta_changelog, $prompt, $multiple_instances, $deletion, $restart_command_line;
string1;

   $newstring1=<<<newstring1
   global $last_modified, $delay, $channel, $major_changelog, $beta_changelog, $prompt, $multiple_instances, $deletion, $restart_command_line;
   global $checkonly, $suctb1,$suctb2,$ctbindex, $susound;   
   
newstring1;
             
   $string2=<<<string2
 if ("$channel" == "0") {

string2;
 
   $newstring2=<<<newstring2
   $suctb1="$icon1";
  $suctb2="$icon2";
  $ctbindex=$buttonindex;
  $susound="$updatesound";
  if ("$channel" == "0") {   
   
newstring2;


  $string3=<<<string3
 if ("$status" == "304") {
string3;

    $newstring3=<<<newstring3
     if ("$status" == "304") {
     if ($checkonly==1){
      ctbicon ("$suctb1",$ctbindex);
     };    

newstring3;

  $string4=<<<string4
   status "$str00200_yLb2oLZnSvh3";
   end "TRUE", , "1";
  };
 };
string4;

   $newstring4=<<<newstring4
   status "$str00200_yLb2oLZnSvh3";
   end "TRUE", , "1";
  };
 };

  if ($checkonly==1) {
  sound "$susound", , 0;
  status "$str00500_yLb2oLZnSvh3";
  $count=1;
  while($count<5){
  ctbicon ("$suctb1",$ctbindex);
  status "$str00500_yLb2oLZnSvh3",,"alert";
  wait (300);
  ctbicon ("$suctb2",$ctbindex);
  status "$str00500_yLb2oLZnSvh3","FF0000","alert";
  wait (300);     
  $count++;
  }
  $checkonly=0;
  delete "0", "0", "$temporary_path";
  //button "ctb$ctbindex";
  end "TRUE", , "1";
  };
  
newstring4;

  $string5=<<<string5
 sub "_Terminate";
string5;

    $newstring5=<<<newstring5
  sub "_Terminate";
 
 if(ctbicon(,$ctbindex)==$suctb2){
    ctbicon($suctb1,$ctbindex);
  };
    
newstring5;

  $string6=<<<string6
 html("http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=8744", "85%", "85%", "$str00900_yLb2oLZnSvh3");
string6;  

    $newstring6=<<<newstring6
   html("http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=8744", "85%", "85%", "$str00900_yLb2oLZnSvh3");
 
 
"_CheckOnly"//#####################################################################################

  global $checkonly;
  $checkonly=1;

newstring6;

/*Replace strings with newstrings  */
   $SU_OnTheFly=replace($SU_Orig,$string1,$newstring1);       
   $SU_OnTheFly=replace($SU_OnTheFly,$string2,$newstring2);
   $SU_OnTheFly=replace($SU_OnTheFly,$string3,$newstring3);
   $SU_OnTheFly=replace($SU_OnTheFly,$string4,$newstring4);
   $SU_OnTheFly=replace($SU_OnTheFly,$string5,$newstring5);
   $SU_OnTheFly=replace($SU_OnTheFly,$string6,$newstring6);

/*Load script and its labels */  
   load $SU_OnTheFly,"_CheckOnly",s;
   load $SU_OnTheFly,"_Initialize",s;
   load $SU_OnTheFly,"Updates",s;
   load $SU_OnTheFly,"_Terminate",s;

Re: SU Helper

Posted: 05 Jun 2013 21:19
by serendipity
For the below script I made 2 icons plus a sound file.
If you like it place icons in XY's icons folder and sound in script folder.
SU_Helper files.zip
SU_helper_Icons.png
su1.ico = XY up-to-date
su2.ico = Update available.

Note: remember to set the correct button index inside the script.

Re: SU Helper

Posted: 06 Jun 2013 13:58
by klownboy
Hey serendipity,
Very nice add-on for Simple Updater. The comments and instructions were well done. I set SU_Helper.xys up as directed in the comments (i.e., button bar number, icon, Simple Updater and wav file paths, etc.) the icon flashed and the red comment came up to say, "A new version of XYplorer is available" and heard the sound, but as it stands right now, am I right in saying, it provides a visual indication, but does not proceed and download the update? It stopped there. I ask because you mentioned further integration with Simple Updater. By the way, I was on my laptop which still has 12.40.0220, so XY did need to be updated (and still does if you need some further testing done).

I'm all for integration as long as there's an option not to look for updates on opening XY. I'd rather look for updates when I want to.

In your comments why not use the ico file names, su1 and su2 instead of su5 and su6...maybe left over from testing/debugging?

Thanks,
Ken

Re: SU Helper

Posted: 06 Jun 2013 14:50
by serendipity
klownboy wrote:Hey serendipity,
Very nice add-on for Simple Updater. The comments and instructions were well done. I set SU_Helper.xys up as directed in the comments (i.e., button bar number, icon, Simple Updater and wav file paths, etc.) the icon flashed and the red comment came up to say, "A new version of XYplorer is available" and heard the sound, but as it stands right now, am I right in saying, it provides a visual indication, but does not proceed and download the update? It stopped there. I ask because you mentioned further integration with Simple Updater. By the way, I was on my laptop which still has 12.40.0220, so XY did need to be updated (and still does if you need some further testing done).

I'm all for integration as long as there's an option not to look for updates on opening XY. I'd rather look for updates when I want to.

In your comments why not use the ico file names, su1 and su2 instead of su5 and su6...maybe left over from testing/debugging?

Thanks,
Ken
Thanks for testing. Glad you like it.
Yes, Visual feedback and optional sound is how it works. Its not supposed to perform the update because that's the job of SimpleUpdater.
So if you have a button setup for that script, just update from the button there.
su5 and 6, yes left over of testing. I'll fix it. :)
Thanks for testing.