2008-10-18

Browser - AutoFill

Save snippet as AutoFill.HTA - then fill out your own specifics in the javascript.

If you create a short-cut one with startup '...AutoFill.HTA" Work' and
one with startup '...AutoFill.HTA" Home' -- it will then start the app with
those preferences.
<html>
<head>
<hta:application
 icon='http://www.blogger.com/favicon.ico'
 id='oAutoFill'
 applicationname='AutoFill'
 >
<title>
AutoFill
</title>
</head>
<body
 onload='AutoFill_OnLoad()'
>
<div
 style="font-family: verdana; font-size: 8pt;"
 >
 I come here and drag/drop into the browser <br>
 preference/setup pages.
</div>
<form 
 name='frmFill'
 >
 <table 
  style="font-family: verdana; font-size: 8pt;"
  >
  <tr>
   <td 
    style='font-family: verdana;font-size: 8pt;'
    >
    T<u>y</u>pe
   </td>
   <td
    style='font-family: verdana;font-size: 8pt;'
    >
    <select 
     id='lstType' 
     onchange='lstType_Change()'
     accesskey='y'
     >
     <option 
      selected 
      value='...'
      >...
     <option 
      value='Home'
      >Home
     <option 
      value='Work'
      >Work
    </select>
   </td>
  </tr>
  <tr>
   <td
    style='font-type:verdana;font-size:12'
    >    
    <u>F</u>irst  
   </td>
   <td>
    <input 
     type='text' 
     id='txtFirst' 
     value='Michael' 
     style='width:105px'
     accesskey='F'
     />
   </td>
   <td
    style='font-type:verdana;font-size:12'
    >
    <u>L</u>ast  
   </td>
   <td>
    <input 
     type='text' 
     id='txtLast' 
     value='Bee'  
     style='width:105px'
     accesskey='L'
     />
   </td>
  </tr>
  <tr>
   <td
    style='font-type:verdana;font-size:12'
    >
    <U>E</u>-mail  
   </td>
   <td>
    <input 
     type='text' 
     id='txtEMail'     
     style='width:105px'
     accesskey='e'
     />
   </td>
   <td
    style='font-type:verdana;font-size:12'
    ><u>H</u>ome page
   </td>
   <td>
    <input 
     type='text' 
     id='txtHomepage' 
     style='width:105px'
     accesskey='h'
     />
   </td>
  </tr>
  <tr>
   <td  
    style='font-type:verdana;font-size:12'
    >
    <u>T</u>elephone 
   </td>
   <td>
    <input 
     type='text' 
     id='txtTelephone' 
     style='width:105px'
     accesskey='t'
     />
   </td>
   <td     
    style='font-type:verdana;font-size:12'
    >
    <u>M</u>obile  
   </td>
   <td>
    <input 
     type='text' 
     id='txtMobile' 
     style='width:105px'
     accesskey='m'
    />
   </td>
  </tr>
  <tr>
   <td     
    style='font-type:verdana;font-size:12'
    >
    <u>A</u>ddress  
   </td>
   <td colspan=3>
    <input 
     type='text' 
     id='txtAddr' 
     style='width:287px'
     accesskey='a'
     />
   </td>
  </tr>
  <tr>
   <td     
    style='font-type:verdana;font-size:12'
    >
    <U>C</u>ity  
   </td>
   <td>
    <input 
     type='text' 
     id='txtCity' 
     style='width:105px'
     accesskey='c'
     />
   </td>
   <td     
    style='font-type:verdana;font-size:12'
    >
    <U>R</u>egion/State
   </td>
   <td>
    <input 
     type='text' 
     id='txtRegSt' 
     style='width:105px'
     accesskey='r'
    />
   </td>
  </tr>
  <td     
   style='font-type:verdana;font-size:12'
   >
   <u>P</u>ostal Code 
  </td>
  <td>
   <input 
    type='text' 
    id='txtPostalCode' 
    style='width:105px'
    accesskey='p'
   >
  </td>
   <td     
    style='font-type:verdana;font-size:12'
    >
    C<u>o</u>untry  
   </td>
   <td>
    <input 
     type='text' 
     id='txtCountry' 
     style='width:105px'
     accesskey='o'
     />
   </td>
  </tr>
 </table>
</form>
<script>
function lstType_Change()
{
//alert(frmFill.lstType.value);
var lChoice=frmFill.lstType.value;
switch (lChoice)
{
case '...':
{
frmFill.txtEMail.value='';
frmFill.txtHomepage.value='';
frmFill.txtTelephone.value='';
frmFill.txtMobile.value='';
frmFill.txtAddr.value='';
frmFill.txtCity.value='';
frmFill.txtRegSt.value='';
frmFill.txtPostalCode.value='';
frmFill.txtCountry.value='';
};
break;
case 'Home':
{
frmFill.txtEMail.value='home_email_pfx'+
'@home_email_sfx';
frmFill.txtHomepage.value='home_homepage_pfx'+
'home_homepage_sfx';
frmFill.txtTelephone.value='home_phn';
frmFill.txtMobile.value='home_mobile_phn';
frmFill.txtAddr.value='home_addr';
frmFill.txtCity.value='home_city';
frmFill.txtRegSt.value='home_regst';
frmFill.txtPostalCode.value='home_postal';
frmFill.txtCountry.value='home_country';
};
break;
case 'Work':
{
frmFill.txtEMail.value='work_email_pfx'+
'@work_email_sfx';
frmFill.txtHomepage.value='work_homepage_pfx'+
'work_homepage_sfx';
frmFill.txtTelephone.value='work_phn';
frmFill.txtMobile.value='work_mobile_phn';
frmFill.txtAddr.value='work_addr';
frmFill.txtCity.value='work_city';
frmFill.txtRegSt.value='work_regst';
frmFill.txtPostalCode.value='work_postal';
frmFill.txtCountry.value='work_country';
};
break;
};
window.document.title='AutoFill '+'['+frmFill.lstType.value+']';
}
function AutoFill_OnLoad()
{
 window.resizeTo(465, 311);
 window.moveTo(305, 133);
 var tra_st=oAutoFill.commandLine.indexOf('.HTA"');
 tra_st=tra_st+6;
 var tra_end=tra_st+4;
 var tra_chars=oAutoFill.commandLine.slice(tra_st,tra_end);
 switch (tra_chars)
 {
 case 'Home':
  {
   frmFill.lstType.value='Home';
   break;
  };

 case 'Work':
  {
   frmFill.lstType.value='Work';
   break;
  };
 };
 lstType_Change();
}
</script>

LibriVox's New Releases

Blog Archive