Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  03 Mar 2015, Zaher Salman, Forum, Starting program from custom page 
    Reply  03 Mar 2015, Stefan Ritt, Forum, Starting program from custom page 
       Reply  03 Mar 2015, Zaher Salman, Forum, Starting program from custom page 
          Reply  03 Mar 2015, Stefan Ritt, Forum, Starting program from custom page 
             Reply  03 Mar 2015, Zaher Salman, Forum, Starting program from custom page 
                Reply  22 Sep 2015, Zaher Salman, Forum, Starting program from custom page 
                   Reply  23 Sep 2015, Konstantin Olchanski, Forum, Starting program from custom page 
Message ID: 1046     Entry time: 03 Mar 2015     In reply to: 1045     Reply to this: 1047
Author: Stefan Ritt 
Topic: Forum 
Subject: Starting program from custom page 
> Hi Stefan, thanks for the quick reply. I guess my question was not clear enough.
> 
> My aim is to create a button which mimics the "Start/Stop" button functionality in the
> "Programs" page where we start all the front-ends for the various equipment. The idea is that
> the user will use a simple interface in a custom page (not the status page) which sets up the
> equipment needed for a specific type of measurement.

All functions in midas are controlled through special URLs. So the URL

http://<host:port>/?cmd=Start&value=10

will start run #10. Similarly with ?cmd=Stop. Now all you need is to set up a custom button, and use the 
OnClick="" JavaScript method to fire off an Ajax request with the above URL. 

To send an Ajax request, you can use the function XMLHttpRequestGeneric which ships as part of midas in the 
mhttpd.js file. Then the code would be

<input type="button" onclick="start()">

and in your JavaScript code:

...
function start()
{
   var request = XMLHttpRequestGeneric();

   url = '?cmd=Start&value=10';
   request.open('GET', url, false);
   request.send(null);
}
...


Cheers,
Stefan
ELOG V3.1.4-2e1708b5