Announcement

Collapse
No announcement yet.

Something New For Developers..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Something New For Developers..

    For me, one problem I've constantly run into is the ability/inability for users to be able to modify global variables in encrypted EFS files. It is simply not possible (once I encrypt a file for distribution). The possible solutions are ...

    1. Provide all of the global variables as INPUTS (in the EDIT window). This is a viable solution, but requires lots of space in the code and lots of work to setup the DEFAULTS for the variables.
    2 Simply distribute the EFS file in an unencrypted format - ok for some - not for others...

    So, I have a spent a bit of time developing a solution...(which was actually quite simple)...

    First, lets assume we have the following global variables in our file...

    PHP Code:
    var StartTime 630;
    var 
    EndTime 1315;
    var 
    DefaultStopOffset 0.50;
    var 
    DefaultPTLevel 1.50;
    var 
    Indicatorvalue1 22
    Now, if I wanted to allow a user to modify these (in an encrypted EFS file), all I would do is copy these values into a TEXT file (using NOTEPAD) and assign a filename to these variables... then add the following to my code...

    PHP Code:
    //---[ text file MENTExmplApp.txt ]------------
    StartTime 630
    EndTime 
    1315
    DefaultStopOffset 
    0.50
    DefaultPTLevel 
    1.50
    Indicatorvalue1 
    22 
    Here is the sample code...
    PHP Code:
    var vSetupFile "MENTExmplApp.txt";

    var 
    StartTime 630;
    var 
    EndTime 1315;
    var 
    DefaultStopOffset 0.50;
    var 
    DefaultPTLevel 1.50;
    var 
    Indicatorvalue1 22;

    function 
    preMain() {

      
    fReadSystemStatus();
    }

    function 
    main() {
      .. 
    your systems code
    }

    function 
    fReadSystemStatus() {
    var 
    tOutString "";

      var 
    = new File(vSetupFile);
       if(
    f.exists()) {  
         
    f.open("rt");
         while(!
    f.eof()) { 
            
    tOutString f.readln();
             eval(
    tOutString);
         }  
         
    f.close();
       } 
    // end if file exists.  

    Now, when the EFS runs, the users variable settings are read from the file and used. So this gives all users the ability to modify/edit contained global variables within an encrypted EFS file. Of course, the TXT file has to be stored in the FORMULAOUTPUT directory - but it works very well.

    Thought this might be of use to other developers..

    B
    Brad Matheny
    eSignal Solution Provider since 2000
Working...
X