Build in Update Chercking

Parent Previous Next

It is possible to think through ways of including methods people can use to check for any new Update for your script if you are giving it away, or it is on an organisations local web server.


Although direct access is not given to the web, TeXworks does provide a system command for launching files by address. (There is no guarantee that a system call to wget or like will work on all systems.)


Provide an option on your form, or in a drop down box or other for the User to be able to check for a new version.


You can call a php script on your local (organisation) or www server passing variables to it in the html query, and show a page that maintains an associative array that determines

whether the script has a new version for download or not and

displays an appropriate message to the User.  This can also be achieved without server side scripting, in the browser by inspecting the  window.location.search property in client-side JavaScript.


      var thisFileName =  TW.script.fileName.substr(

                       TW.script.fileName.lastIndexOf("/") +1

                                                 );


var checkFile = "checkFile.php?script=" + thisFileName

               + "&version=" + TW.script.version;

   

  var whatHappened =  TW.launchFile(

                         "http://twscript.paulanorman.info/downloads/"

                         + checkFile

                                    );

     

     if (whatHappened.status != 0) // call failed

       {

        TW.information("What Happened", whatHappened['message']);

        } //



Or a more basic approach is to point to a down load page with version information already shown. This would mean showing the User what the script name and version number were perhaps as part of any form, drop-down (getItem) or Information box being presented to them.


var thisOne = TW.getItem(null, "Please Choose",  "This is: " + TW.script.title  

                        +  " version: <b>" + TW.script.version

                        +"</b>  "+ thisFileName                            

//  Not available        + "<br> Dated : " + TW.script.date

                             + "<br> Please Check for Updates at\n   <span style='color:navy; text-decoration: underline; cursor:none' title='Choose Update from Drop Box'>twscript.PaulANorman.info</span>"

                           

                           +"<br><br>Please Choose..."

                           , mainList // mainList is an array

                           , 2

                           , false

                           );


Then something like...


     var whatHappened =  TW.launchFile("http://twscript.paulanorman.info/downloads/");

     

     if (whatHappened.status != 0) // call failed

       {

        TW.information("What Happened", whatHappened['message']);

        } //



Created with the Personal Edition of HelpNDoc: Easily create CHM Help documents