title: Script to auto populate fields in active browser window from table in clipboard
body: <p>Basically I would like to write a script to paste specific cells from a table, which has been copied from outlook, into the corresponding fields within an active web form.</p>
  
  <p>The web form URL will change according to its unique reference number, the CommentID as in the 986734 in the following example: <a href="https://xxx.xxx.com.au/trisprod/comment_line/cmnt_action.cfm?CommentID=986734&amp;Refresh=TRUE" rel="nofollow">https://xxx.xxx.com.au/trisprod/comment_line/cmnt_action.cfm?CommentID=986734&amp;Refresh=TRUE</a></p>
  
  <p>When the table is pasted into notepad it is separated by lines and tabs:</p>
  
  <p><strong>Edit:</strong> I have just realised I can't post pictures without 10 rep so copy and paste from outlook</p>
  
  <pre><code>First name      Test
  Last name       Test
  Phone number    8888 8888
  Email address   xxx@xxx.com.au
  
  Response required   Yes
  Route/line          180
  From location       CBD
  To location         XXX
  Travel date         20/11/2013
  Travel time         10:38 am
  Comments    something something somethingsomething something somethingsomething something somethingsomething something somethingsomething something something
  </code></pre>
  
  <p>So there will be eleven fields in total: <code>First name, Last name, Phone number, Email address, Response required(yes/no,true/false), Route/line, From location, To location, Travel Date, Travel time</code> and <code>Comments</code></p>
  
  <p>If one of these inputs were missing the script would just move to the next field.</p>
  
  <p>After using the <code>Inspect Element (Q)</code> function in firefox the following captures show the first few fields:![Heading Capture][2]</p>
  
  <p>![HTML? of page![][3]][3]</p>
  
  <p>The script would have to work regardless of browser used so both firefox and IE.</p>
  
  <p>So basically the table would be copied to the clip board, then the web form would be clicked in to make it the active window and then the script would be run to paste the clipboard data into the correct fields, ideally triggered by hot key.</p>
  
  <p>I am a complete Noob, happy to research but not even sure what language to begin learning or what terms to search- It seemed i was just going around in circles. Any assistance on what language to begin leaning or any direction to tutorials that may be helpful would be greatly appreciated. Thanks in advance and sorry about tags if irrelevant.</p>
  
  <p><strong>Edit</strong>, I have just realised I can't post pictures without 10 rep so copy and paste from <code>Inspect Element (Q)</code> function in firefox:</p>
  
  <pre><code>&lt;form name="frmCmnt_actions2" method="post" target="_top" action="cmnt_action_update.cfm?Step=0&amp;amp;Refresh=TRUE"&gt;
      &lt;input name="CommentID" value="986734" type="hidden"&gt;
      &lt;input name="SubmitOption" value="FWD" type="Hidden"&gt;
      &lt;h3&gt;Enter New Comment &amp;nbsp;&amp;nbsp; #986734&lt;/h3&gt;
      &lt;table border="0" cellpadding="2" cellspacing="1" width="100%"&gt;
          &lt;tbody&gt;
              &lt;tr&gt;
                  &lt;td class="TableHead"&gt; &lt;strong&gt;Description:&lt;/strong&gt;&lt;font color="#ff0000" size="-2"&gt;*&lt;/font&gt; &lt;br&gt;
                      &lt;font size="1"&gt;(max 4000 chars)&lt;/font&gt; &lt;/td&gt;
                  &lt;td class="smTable" colspan="2"&gt;
                      &lt;textarea onfocus="this.rows=25" onblur="checkSize(this,4000);this.rows=8" name="Description" rows="8" cols="72" wrap="soft"&gt;&lt;/textarea&gt;
                  &lt;/td&gt;
                  &lt;input name="DialogResponses" type="hidden"&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="TableHead"&gt;&lt;strong&gt;Comment Type:&lt;/strong&gt;&lt;font color="#ff0000" size="-2"&gt;*&lt;/font&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="tablehead"&gt;
                      &lt;input name="RDDay" value="29" type="hidden"&gt;
                      &lt;input name="RDMth" value="11" type="hidden"&gt;
                      &lt;input name="RDYr" value="2013" type="hidden"&gt;
                      &lt;strong&gt;Reported:&lt;/strong&gt; &lt;/td&gt;
                  &lt;td colspan="2" class="smTable"&gt;&lt;strong&gt;29/11/2013&lt;/strong&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="TableHead"&gt;&lt;strong&gt;Incident Date:&lt;/strong&gt;&lt;font color="#ff0000" size="-2"&gt;*&lt;/font&gt;&lt;/td&gt;
                  &lt;td colspan="2" class="smTable"&gt;
                      &lt;input name="IncidentDay" id="IncidentDay" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,1,31,'Incident Day',true);" type="Text"&gt;
                      &lt;input name="IncidentMth" id="IncidentMth" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,1,12,'Incident Month',true);" type="Text"&gt;
                      &lt;input name="IncidentYr" id="IncidentYr" required size="4" maxlength="4" value="" onblur="checkIntegerWithinRange(this,2000,2099,'Incident Year',true);" type="Text"&gt;
                      &lt;input name="IncidentDate" type="Hidden"&gt;
                      &amp;nbsp;&amp;nbsp;&amp;nbsp;
                      &lt;input class="Button" value="Today" onclick="setIncidentDateToToday();" type="Button"&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="TableHead"&gt;&lt;strong&gt;Incident Time:&lt;/strong&gt;&lt;/td&gt;
                  &lt;td colspan="2" class="smTable"&gt;
                      &lt;input name="IncidentHr" id="IncidentHr" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,0,23,'Incident Hour',true);" type="Text"&gt;
                      &lt;input name="IncidentMin" id="IncidentMin" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,0,59,'Incident Minute',true);" type="Text"&gt;
                      24 Hr&lt;/td&gt;
                  &lt;input name="IncidentTime" type="Hidden"&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="TableHead"&gt;&lt;strong&gt;Incident Location:&lt;/strong&gt;&lt;/td&gt;
                  &lt;td colspan="2"&gt;
                      &lt;input name="IncidentLocation" id="IncidentLocation" required size="30" maxlength="100" value="" type="Text"&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="TableHead"&gt;&lt;strong&gt;Service Destination:&lt;/strong&gt;&lt;/td&gt;
                  &lt;td colspan="2"&gt;
                      &lt;input name="ServiceDestination" id="ServiceDestination" required size="30" maxlength="100" value="" type="Text"&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="TableHead"&gt;&lt;strong&gt;Service Departure Time:&lt;/strong&gt;&lt;/td&gt;
                  &lt;td colspan="2" class="smTable"&gt;
                      &lt;input name="ServiceDepartureHr" id="ServiceDepartureHr" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,0,23,'Service Departure Hour',true);" type="Text"&gt;
                      &lt;input name="ServiceDepartureMin" id="ServiceDepartureMin" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,0,59,'Service Departure Minute',true);" type="Text"&gt;
                      24 Hr&lt;/td&gt;
                  &lt;input name="ServiceDepartureTime" type="Hidden"&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="TableHead" width="20%"&gt;&lt;strong&gt;Service Direction:&lt;/strong&gt;&lt;font color="#ff0000" size="-2"&gt;*&lt;/font&gt;&lt;/td&gt;
                  &lt;td class="smTable" colspan="2"&gt;
                      &lt;table border="0" cellpadding="0" cellspacing="0"&gt;
                          &lt;tbody&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;
                                      &lt;input name="ServiceDirection" value="T" type="radio"&gt;
                                      Inbound&amp;nbsp;&amp;nbsp;&lt;/td&gt;
                                  &lt;td&gt;
                                      &lt;input name="ServiceDirection" value="F" type="radio"&gt;
                                      Outbound&amp;nbsp;&amp;nbsp;&lt;/td&gt;
                                  &lt;td&gt;
                                      &lt;input name="ServiceDirection" value="R" type="radio"&gt;
                                      Regional&amp;nbsp;&amp;nbsp;&lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/tbody&gt;
                      &lt;/table&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td class="TableHead"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td class="smTable" colspan="2"&gt;
      &lt;table border="0" cellpadding="0" cellspacing="0"&gt;
      &lt;tbody&gt;
          &lt;tr id="extra1_bus_busno" style=""&gt;
              &lt;td class="smTable"&gt;&lt;strong&gt;Bus Number:&lt;/strong&gt;&lt;/td&gt;
              &lt;td class="smTable"&gt;
                  &lt;input name="BusNumber" id="BusNumber" size="10" maxlength="200" value="" type="text"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr id="extra1_bus_routecode" style=""&gt;
              &lt;td class="smTable"&gt;&lt;strong&gt;Route:&lt;/strong&gt;&lt;/td&gt;
              &lt;td class="smTable"&gt;
                  &lt;input name="RouteName" id="RouteCode" size="10" value="" type="text"&gt;
                  &lt;input class="Button" value="Find" onclick="FindRoute();" type="Button"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;/option&gt;
              &lt;option value="1182"&gt;1 &lt;/option&gt;
              &lt;option value="1025"&gt;2 &lt;/option&gt;
              &lt;option value="1026"&gt;3 &lt;/option&gt;
              &lt;option value="1045"&gt;4 &lt;/option&gt;
              &lt;option value="1047"&gt;5 &lt;/option&gt;
              &lt;option value="1048"&gt;6 &lt;/option&gt;
              &lt;option value="1049"&gt;7 &lt;/option&gt;
          &lt;/select&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;Respondent:&lt;/strong&gt; &lt;font color="#ff0000" size="-2"&gt;*&lt;/font&gt;&lt;/td&gt;
          &lt;td colspan="2" class="smTable"&gt;
              &lt;textarea name="RespondentName" id="RespondentName" rows="2" cols="60" wrap="soft" readonly onfocus="setRespondents();"&gt;&lt;/textarea&gt;
              &lt;br&gt;
              &lt;input checked="" name="ckEmail" type="Checkbox"&gt;
              &amp;nbsp;Send an E-mail to the respondent
              &lt;input name="radEmailOpt" checked="" type="Radio"&gt;
              Automatic
              &lt;input name="radEmailOpt" onclick="CheckNavforEmail()" type="Radio"&gt;
              Pop-up (for attachments)
              &lt;input value="" name="RespondentEmail" type="Hidden"&gt;
              &lt;input name="blnEmail" value="Y" type="Hidden"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td colspan="3"&gt;
              &lt;hr&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;First Name:&lt;/strong&gt; &lt;font color="#ff0000" size="-2"&gt;*&lt;/font&gt;&lt;/td&gt;
          &lt;td class="smTable"&gt;
              &lt;input name="CustName" size="25" maxlength="100" value="" type="Text"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;Surname:&lt;/strong&gt; &lt;font color="#ff0000" size="-2"&gt;*&lt;/font&gt;&lt;/td&gt;
          &lt;td class="smTable"&gt;
              &lt;input name="CustSurname" size="25" maxlength="100" value="" type="Text"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;Title:&lt;/strong&gt;&lt;/td&gt;
          &lt;td class="smTable"&gt;
              &lt;input name="CustTitle" size="10" maxlength="10" value="" type="Text"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;Address:&lt;/strong&gt;&lt;/td&gt;
          &lt;td class="smTable"&gt;
              &lt;input name="CustAddr" size="25" maxlength="100" value="" type="Text"&gt;
              &lt;input name="PrefContact" value="A" type="radio"&gt;
              Preferred Contact Channel &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;Suburb:&lt;/strong&gt;&lt;/td&gt;
          &lt;td class="smTable"&gt;
              &lt;input name="CustSub" size="25" maxlength="100" value="" type="Text"&gt;
              &lt;input name="CustPostCode" size="4" maxlength="4" value="" type="Text"&gt;
              &lt;input class="Button" value="Find" onclick="FindSub('');" type="Button"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;Email:&lt;/strong&gt;&lt;/td&gt;
          &lt;td class="smTable"&gt;
              &lt;input name="CustEmail" size="25" maxlength="50" value="" type="Text"&gt;
              &lt;input name="PrefContact" value="E" type="radio"&gt;
              Preferred Contact Channel &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;Home Phone Number:&lt;/strong&gt;&lt;/td&gt;
          &lt;td class="smTable"&gt;
              &lt;input name="CustHomePh" size="20" maxlength="20" value="" type="Text"&gt;
              &lt;input name="PrefContact" value="H" checked="" type="radio"&gt;
              Preferred Contact Channel &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;Work Phone Number:&lt;/strong&gt;&lt;/td&gt;
          &lt;td class="smTable"&gt;
              &lt;input name="CustWorkPh" size="20" maxlength="20" value="" type="Text"&gt;
              &lt;input name="PrefContact" value="W" type="radio"&gt;
              Preferred Contact Channel &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="TableHead"&gt;&lt;strong&gt;Mobile Number:&lt;/strong&gt;&lt;/td&gt;
          &lt;td class="smTable"&gt;
              &lt;input name="CustMobPh" size="20" maxlength="20" value="" type="Text"&gt;
              &lt;input name="PrefContact" value="M" type="radio"&gt;
              Preferred Contact Channel &lt;/td&gt;
      &lt;/tr&gt;
  </code></pre>