title: Google form that turns on and off each day automatically
body: <p>I love Google Forms I can play with them for hours. I have spent days trying to solve this one, searching for an answer. It is very much over my head. I have seen similar questions but none that seemed to have helped me get to an answer. We have a café where I work and I created a pre-order form on Google Forms. That was the easy part. The Café can only accept pre-orders up to 10:30am. I want the form to open at 7am and close at 10:30am everyday to stop people pre ordering when the café isn't able to deal with their order. I used the very helpful tutorial from <a href="http://labnol.org/?p=20707" rel="nofollow noreferrer">http://labnol.org/?p=20707</a> to start me off I have added and messed it up and managed to get back to the below which is currently how it looks. It doesn't work and I can't get my head around it. At one point I managed to turn it off but I couldn't turn it back on!! I'm finding it very frustrating and any help in solving this would be amazing. To me it seems very simple as it just needs to turn on and off at a certain time every day. I don't know! Please help me someone?</p>
  
  <pre><code>FORM_OPEN_DATE   =  "7:00";
  FORM_CLOSE_DATE  =  "10:30";
  RESPONSE_COUNT   =  "";
  
  /* Initialize the form, setup time based triggers */
  function Initialize() {
  
  deleteTriggers_();
  
  if ((FORM_OPEN_DATE !== "7:00") &amp;&amp; 
    ((new Date()).getTime("7:00") &lt; parseDate_(FORM_OPEN_DATE).getTime       ("7:00"))) { 
  closeForm("10:30");
  ScriptApp.newTrigger("openForm")
  .timeBased("7:00")
  .at(parseDate_(FORM_OPEN_DATE))
  .create(); }
  
  if (FORM_CLOSE_DATE !== "10:30") { 
  ScriptApp.newTrigger("closeForm")
  .timeBased("10:30")
  .at(parseDate_(FORM_CLOSE_DATE))
  .create(); }
  
  if (RESPONSE_COUNT !== "") { 
  ScriptApp.newTrigger("checkLimit")
  .forForm(FormApp.getActiveForm())
  .onFormSubmit()
  .create();   }   }
  
   /* Delete all existing Script Triggers */
  function deleteTriggers_() {  
    var triggers = ScriptApp.getProjectTriggers();  
    for (var i in triggers) {
     ScriptApp.deleteTrigger(triggers[i]);
   }
    }
  
    /* Allow Google Form to Accept Responses */
     function openForm() {
       var form = FormApp.getActiveForm();
     form.setAcceptingResponses(true);
     informUser_("Your Google Form is now accepting responses");
   }
  
   /* Close the Google Form, Stop Accepting Reponses */
   function closeForm() {  
   var form = FormApp.getActiveForm();
   form.setAcceptingResponses(false);
   deleteTriggers_();
    informUser_("Your Google Form is no longer accepting responses");
   }
  
  /* If Total # of Form Responses &gt;= Limit, Close Form */
    function checkLimit() {
    if (FormApp.getActiveForm().getResponses().length &gt;= RESPONSE_COUNT ) {
    closeForm();
     }  
    }
  
    /* Parse the Date for creating Time-Based Triggers */
    function parseDate_(d) {
     return new Date(d.substr(0,4), d.substr(5,2)-1, 
                 d.substr(8,2), d.substr(11,2), d.substr(14,2));
     }
  </code></pre>