Javascript 用于从剪贴板中的表自动填充活动浏览器窗口中的字段的脚本
基本上,我想编写一个脚本,将从outlook复制的表中的特定单元格粘贴到活动web表单中的相应字段中 web表单URL将根据其唯一参考号(CommentID)进行更改,如以下示例中的986734所示: 将表格粘贴到记事本中时,表格由线条和选项卡分隔: 编辑:我刚刚意识到如果没有10个代表,我就无法发布图片,所以请从outlook复制并粘贴Javascript 用于从剪贴板中的表自动填充活动浏览器窗口中的字段的脚本,javascript,jquery,html,vb.net,outlook,Javascript,Jquery,Html,Vb.net,Outlook,基本上,我想编写一个脚本,将从outlook复制的表中的特定单元格粘贴到活动web表单中的相应字段中 web表单URL将根据其唯一参考号(CommentID)进行更改,如以下示例中的986734所示: 将表格粘贴到记事本中时,表格由线条和选项卡分隔: 编辑:我刚刚意识到如果没有10个代表,我就无法发布图片,所以请从outlook复制并粘贴 First name Test Last name Test Phone number 8888 8888 Email addre
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
因此总共有11个字段:姓名、姓氏、电话号码、电子邮件地址、所需回复(是/否、对/错)、路线/线路、从地点到地点、旅行日期、旅行时间和评论
如果其中一个输入丢失,脚本将移动到下一个字段
在firefox中使用Inspect Element(Q)
函数后,以下捕获显示了前几个字段:![标题截图][2]
!![HTML?共页![[3]][3]
无论使用何种浏览器,该脚本都必须工作,因此firefox和IE都必须工作
因此,基本上,表格将被复制到剪贴板上,然后点击web表单使其成为活动窗口,然后运行脚本将剪贴板数据粘贴到正确的字段中,最好由热键触发
我是一个彻头彻尾的傻瓜,乐于研究,但甚至不确定该开始学习什么语言或搜索什么术语——我似乎只是在兜圈子。任何关于开始学习哪种语言的帮助或任何可能有帮助的指导都将不胜感激。提前感谢,如果标签不相关,请道歉
编辑,我刚刚意识到没有10次重复我无法发布图片,所以从firefox中的Inspect Element(Q)
功能复制并粘贴:
<form name="frmCmnt_actions2" method="post" target="_top" action="cmnt_action_update.cfm?Step=0&Refresh=TRUE">
<input name="CommentID" value="986734" type="hidden">
<input name="SubmitOption" value="FWD" type="Hidden">
<h3>Enter New Comment #986734</h3>
<table border="0" cellpadding="2" cellspacing="1" width="100%">
<tbody>
<tr>
<td class="TableHead"> <strong>Description:</strong><font color="#ff0000" size="-2">*</font> <br>
<font size="1">(max 4000 chars)</font> </td>
<td class="smTable" colspan="2">
<textarea onfocus="this.rows=25" onblur="checkSize(this,4000);this.rows=8" name="Description" rows="8" cols="72" wrap="soft"></textarea>
</td>
<input name="DialogResponses" type="hidden">
</tr>
<tr>
<td class="TableHead"><strong>Comment Type:</strong><font color="#ff0000" size="-2">*</font></td>
</tr>
<tr>
<td class="tablehead">
<input name="RDDay" value="29" type="hidden">
<input name="RDMth" value="11" type="hidden">
<input name="RDYr" value="2013" type="hidden">
<strong>Reported:</strong> </td>
<td colspan="2" class="smTable"><strong>29/11/2013</strong></td>
</tr>
<tr>
<td class="TableHead"><strong>Incident Date:</strong><font color="#ff0000" size="-2">*</font></td>
<td colspan="2" class="smTable">
<input name="IncidentDay" id="IncidentDay" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,1,31,'Incident Day',true);" type="Text">
<input name="IncidentMth" id="IncidentMth" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,1,12,'Incident Month',true);" type="Text">
<input name="IncidentYr" id="IncidentYr" required size="4" maxlength="4" value="" onblur="checkIntegerWithinRange(this,2000,2099,'Incident Year',true);" type="Text">
<input name="IncidentDate" type="Hidden">
<input class="Button" value="Today" onclick="setIncidentDateToToday();" type="Button">
</td>
</tr>
<tr>
<td class="TableHead"><strong>Incident Time:</strong></td>
<td colspan="2" class="smTable">
<input name="IncidentHr" id="IncidentHr" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,0,23,'Incident Hour',true);" type="Text">
<input name="IncidentMin" id="IncidentMin" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,0,59,'Incident Minute',true);" type="Text">
24 Hr</td>
<input name="IncidentTime" type="Hidden">
</tr>
<tr>
<td class="TableHead"><strong>Incident Location:</strong></td>
<td colspan="2">
<input name="IncidentLocation" id="IncidentLocation" required size="30" maxlength="100" value="" type="Text">
</td>
</tr>
<tr>
<td class="TableHead"><strong>Service Destination:</strong></td>
<td colspan="2">
<input name="ServiceDestination" id="ServiceDestination" required size="30" maxlength="100" value="" type="Text">
</td>
</tr>
<tr>
<td class="TableHead"><strong>Service Departure Time:</strong></td>
<td colspan="2" class="smTable">
<input name="ServiceDepartureHr" id="ServiceDepartureHr" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,0,23,'Service Departure Hour',true);" type="Text">
<input name="ServiceDepartureMin" id="ServiceDepartureMin" required size="2" maxlength="2" value="" onblur="checkIntegerWithinRange(this,0,59,'Service Departure Minute',true);" type="Text">
24 Hr</td>
<input name="ServiceDepartureTime" type="Hidden">
</tr>
<tr>
<td class="TableHead" width="20%"><strong>Service Direction:</strong><font color="#ff0000" size="-2">*</font></td>
<td class="smTable" colspan="2">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<input name="ServiceDirection" value="T" type="radio">
Inbound </td>
<td>
<input name="ServiceDirection" value="F" type="radio">
Outbound </td>
<td>
<input name="ServiceDirection" value="R" type="radio">
Regional </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="TableHead"> </td>
<td class="smTable" colspan="2">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr id="extra1_bus_busno" style="">
<td class="smTable"><strong>Bus Number:</strong></td>
<td class="smTable">
<input name="BusNumber" id="BusNumber" size="10" maxlength="200" value="" type="text">
</td>
</tr>
<tr id="extra1_bus_routecode" style="">
<td class="smTable"><strong>Route:</strong></td>
<td class="smTable">
<input name="RouteName" id="RouteCode" size="10" value="" type="text">
<input class="Button" value="Find" onclick="FindRoute();" type="Button">
</td>
</tr>
</option>
<option value="1182">1 </option>
<option value="1025">2 </option>
<option value="1026">3 </option>
<option value="1045">4 </option>
<option value="1047">5 </option>
<option value="1048">6 </option>
<option value="1049">7 </option>
</select>
</td>
</tr>
</tr>
<tr>
<td class="TableHead"><strong>Respondent:</strong> <font color="#ff0000" size="-2">*</font></td>
<td colspan="2" class="smTable">
<textarea name="RespondentName" id="RespondentName" rows="2" cols="60" wrap="soft" readonly onfocus="setRespondents();"></textarea>
<br>
<input checked="" name="ckEmail" type="Checkbox">
Send an E-mail to the respondent
<input name="radEmailOpt" checked="" type="Radio">
Automatic
<input name="radEmailOpt" onclick="CheckNavforEmail()" type="Radio">
Pop-up (for attachments)
<input value="" name="RespondentEmail" type="Hidden">
<input name="blnEmail" value="Y" type="Hidden">
</td>
</tr>
</td>
</tr>
<tr>
<td colspan="3">
<hr>
</td>
</tr>
<tr>
<td class="TableHead"><strong>First Name:</strong> <font color="#ff0000" size="-2">*</font></td>
<td class="smTable">
<input name="CustName" size="25" maxlength="100" value="" type="Text">
</td>
</tr>
<tr>
<td class="TableHead"><strong>Surname:</strong> <font color="#ff0000" size="-2">*</font></td>
<td class="smTable">
<input name="CustSurname" size="25" maxlength="100" value="" type="Text">
</td>
</tr>
<tr>
<td class="TableHead"><strong>Title:</strong></td>
<td class="smTable">
<input name="CustTitle" size="10" maxlength="10" value="" type="Text">
</td>
</tr>
<tr>
<td class="TableHead"><strong>Address:</strong></td>
<td class="smTable">
<input name="CustAddr" size="25" maxlength="100" value="" type="Text">
<input name="PrefContact" value="A" type="radio">
Preferred Contact Channel </td>
</tr>
<tr>
<td class="TableHead"><strong>Suburb:</strong></td>
<td class="smTable">
<input name="CustSub" size="25" maxlength="100" value="" type="Text">
<input name="CustPostCode" size="4" maxlength="4" value="" type="Text">
<input class="Button" value="Find" onclick="FindSub('');" type="Button">
</td>
</tr>
<tr>
<td class="TableHead"><strong>Email:</strong></td>
<td class="smTable">
<input name="CustEmail" size="25" maxlength="50" value="" type="Text">
<input name="PrefContact" value="E" type="radio">
Preferred Contact Channel </td>
</tr>
<tr>
<td class="TableHead"><strong>Home Phone Number:</strong></td>
<td class="smTable">
<input name="CustHomePh" size="20" maxlength="20" value="" type="Text">
<input name="PrefContact" value="H" checked="" type="radio">
Preferred Contact Channel </td>
</tr>
<tr>
<td class="TableHead"><strong>Work Phone Number:</strong></td>
<td class="smTable">
<input name="CustWorkPh" size="20" maxlength="20" value="" type="Text">
<input name="PrefContact" value="W" type="radio">
Preferred Contact Channel </td>
</tr>
<tr>
<td class="TableHead"><strong>Mobile Number:</strong></td>
<td class="smTable">
<input name="CustMobPh" size="20" maxlength="20" value="" type="Text">
<input name="PrefContact" value="M" type="radio">
Preferred Contact Channel </td>
</tr>
输入新注释#986734
说明:*
(最多4000个字符)
评论类型:*
报告:
2013年11月29日
事件日期:*
事件时间:
24小时
事件地点:
服务目的地:
服务出发时间:
24小时
服务方向:*
入境
出境
区域的
公交车号:
路线:
1.
2.
3.
4.
5.
6.
7.
受访者:*
向受访者发送电子邮件
自动的
弹出窗口(用于附件)
名字:*
姓氏:*
标题:
地址:
首选联系渠道
郊区:
电子邮件:
首选联系渠道
家庭电话号码:
首选联系渠道
工作电话号码:
首选联系渠道
手机号码:
首选联系渠道
对于浏览器安全性,这是一个命中或未命中的选项。我知道你想要什么,但有些浏览器不允许这是一个安全问题。我确信这不是最有说服力的解决方案,但它满足了我的需要
无标题-消息(HTML)<可以被任何窗口标题替换,并且是复制数据的来源。>FirefoxSet WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
Set Shell = WScript.CreateObject("WScript.Shell")
Shell.AppActivate("Untitled - Message (HTML)")
WScript.Sleep 100
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
WScript.Sleep 100
Shell.SendKeys "{TAB}"
WScript.Sleep 100
Shell.SendKeys ("^c")
WScript.Sleep 100
Shell.AppActivate"Firefox"
WScript.Sleep 100
Shell.SendKeys "{TAB}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.AppActivate("Untitled - Message (HTML)")
WScript.Sleep 100
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("^c")
WScript.Sleep 100
Shell.AppActivate"Firefox"
WScript.Sleep 100
Shell.SendKeys "{TAB 2}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.SendKeys "{BACKSPACE 8}"
WScript.Sleep 100
Shell.SendKeys "{TAB}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.SendKeys "{BACKSPACE 5}"
WScript.Sleep 100
Shell.SendKeys "{LEFT 2}"
WScript.Sleep 100
Shell.SendKeys "{BACKSPACE 3}"
WScript.Sleep 100
Shell.SendKeys "{RIGHT 2}"
WScript.Sleep 100
Shell.SendKeys "{TAB}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.SendKeys "{LEFT 4}"
WScript.Sleep 100
Shell.SendKeys "{BACKSPACE 6}"
WScript.Sleep 100
Shell.SendKeys "{RIGHT 4}"
WScript.Sleep 100
Shell.AppActivate("Untitled - Message (HTML)")
WScript.Sleep 100
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("^c")
WScript.Sleep 100
Shell.AppActivate"Firefox"
WScript.Sleep 100
Shell.SendKeys "{TAB 4}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.AppActivate("Untitled - Message (HTML)")
WScript.Sleep 100
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
WScript.Sleep 100
Shell.SendKeys "{TAB 2}"
WScript.Sleep 100
Shell.SendKeys ("^c")
WScript.Sleep 100
Shell.AppActivate"Firefox"
WScript.Sleep 100
Shell.SendKeys "{TAB}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.AppActivate("Untitled - Message (HTML)")
WScript.Sleep 100
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("^c")
WScript.Sleep 100
Shell.AppActivate"Firefox"
WScript.Sleep 100
Shell.SendKeys "{TAB 12}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.AppActivate("Untitled - Message (HTML)")
WScript.Sleep 100
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("^c")
WScript.Sleep 100
Shell.AppActivate"Firefox"
WScript.Sleep 100
Shell.SendKeys "{TAB 10}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.AppActivate("Untitled - Message (HTML)")
WScript.Sleep 100
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
WScript.Sleep 100
Shell.SendKeys "{TAB 2}"
WScript.Sleep 100
Shell.SendKeys ("^c")
WScript.Sleep 100
Shell.AppActivate"Firefox"
WScript.Sleep 100
Shell.SendKeys "{TAB}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.AppActivate("Untitled - Message (HTML)")
WScript.Sleep 100
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
WScript.Sleep 100
Shell.SendKeys "{TAB 4}"
WScript.Sleep 100
Shell.SendKeys ("^c")
WScript.Sleep 100
Shell.AppActivate"Firefox"
WScript.Sleep 100
Shell.SendKeys "{TAB 7}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.SendKeys "{TAB}"
WScript.Sleep 100
Shell.SendKeys "{ENTER}"
WScript.Sleep 100
Shell.AppActivate("Untitled - Message (HTML)")
WScript.Sleep 100
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("+{TAB}")
WScript.Sleep 100
Shell.SendKeys ("^c")
WScript.Sleep 100
Shell.AppActivate"Firefox"
WScript.Sleep 100
Shell.SendKeys "{TAB 5}"
WScript.Sleep 100
Shell.SendKeys ("^v")'Paste
WScript.Sleep 100
Shell.SendKeys "{TAB 3}"
WScript.Sleep 100
Shell.SendKeys "PAX requested no response"