В принципе, я хотел бы написать скрипт для вставки определенных ячеек из таблицы, которая была скопирована из Outlook, в соответствующие поля в активной веб-форме.
URL-адрес веб-формы будет изменяться в соответствии с его уникальным ссылочным номером CommentID, как в 986734, в следующем примере: https://xxx.xxx.com.au/trisprod/comment_line/cmnt_action.cfm?CommentID=986734&Refresh=TRUE
Когда таблица вставлена в блокнот, она разделяется линиями и вкладками:
Редактирование: я только что понял, что не могу опубликовать фотографии без 10 повторений, поэтому скопируйте и вставьте из Outlook
First name Test
Last name Test
Phone number 8888 8888
Email address [email protected]
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
Таким образом, будет всего одиннадцать полей: First name, Last name, Phone number, Email address, Response required(yes/no,true/false), Route/line, From location, To location, Travel Date, Travel time
и Comments
Если один из этих входов отсутствовал, скрипт просто переместится в следующее поле.
После использования функции Inspect Element (Q)
в firefox следующие записи показывают первые несколько полей:! [Heading Capture] [2]
! [HTML? страницы! [] [3]] [3]
Сценарий должен работать независимо от браузера, используемого так как firefox, так и IE.
Таким образом, в основном таблица будет скопирована на плату клипа, затем будет нажата веб-форма, чтобы сделать ее активным окном, а затем будет запущен скрипт для вставки данных буфера обмена в правильные поля, в идеале вызванные горячей клавишей.
Я полный Noob, счастлив исследовать, но даже не знаю, на каком языке начать учиться или какие термины search- Кажется, я просто крутился по кругу. Будет очень признательна любая помощь на том, какой язык начать склоняться или какое-либо руководство к учебникам, которые могут быть полезны. Спасибо заранее и извините за теги, если они неактуальны.
Редактирование, я только что понял, что я не могу публиковать фотографии без 10 rep, поэтому скопируйте и вставьте из функции Inspect Element (Q)
в firefox:
<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>
Я уверен, что это не самое красноречивое решение, но оно отвечает моим потребностям.
Untitled - Message (HTML) <может быть заменено любым заголовком окна и с которого копируются данные. > Firefox <- это окно для публикации (так что у меня есть отдельный скрипт для IE).
Чтобы очистить буфер обмена, чтобы устранить любую проблему из-за пустого поля, необходимо было следующее:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL | clip", 0, True
Были некоторые проблемы с поведением SendKeys из-за того, что ключевые штрихи опередили процессор, что привело к непоследовательным и непредсказуемым результатам. Это было разрешено с помощью команд> WScript.Sleep 100 <между линиями. Полный скрипт:
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"
С защитой браузера это вариант с ошибкой или пропуском. Я вижу, что вы хотите, но некоторые браузеры не позволяют это как проблему безопасности.