<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; HTML (in IE)/JS: Копирование выделения на страницк как "plain text"]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=7530</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7530&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «HTML (in IE)/JS: Копирование выделения на страницк как "plain text"».]]></description>
		<lastBuildDate>Wed, 05 Sep 2012 15:26:22 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: HTML (in IE)/JS: Копирование выделения на страницк как "plain text"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63540#p63540</link>
			<description><![CDATA[<div class="quotebox"><cite>Rom5 пишет:</cite><blockquote><div class="codebox"><pre><code>vb_Trim = RTrim( LTrim(ps) ) &#039;почему-то одной функции Trim() не достаточно!:(&#039;</code></pre></div></blockquote></div><p>Мне хватало: <a href="http://forum.script-coding.com/viewtopic.php?id=1080">VBScript: сохранить выделенный в Internet Explorer текст в файл</a> <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" />.</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Wed, 05 Sep 2012 15:26:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63540#p63540</guid>
		</item>
		<item>
			<title><![CDATA[Re: HTML (in IE)/JS: Копирование выделения на страницк как "plain text"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63536#p63536</link>
			<description><![CDATA[<p>для работы с буфером лучше всего подходит флеш (к слову)</p>]]></description>
			<author><![CDATA[null@example.com (smaharbA)]]></author>
			<pubDate>Wed, 05 Sep 2012 14:07:43 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63536#p63536</guid>
		</item>
		<item>
			<title><![CDATA[HTML (in IE)/JS: Копирование выделения на страницк как "plain text"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63535#p63535</link>
			<description><![CDATA[<p>Сделал для облегчения &quot;копи-паста&quot; со страниц IE содержимого выделения в текстовом виде (без форматирования) короткий скрипт, который вызывается из контекстного меню IE мои дополнительным пунктом &quot;Copy (as plain text;)&quot;.</p><p>Скрипт для инсталл/деинсталла пункта в меню:<br /></p><div class="codebox"><pre><code>
&#039; IE_copyAsText_setup.vbs
&#039; ----------------------------------------------------------------------------------------
&#039; Добавляет/Удаляет в контекстное меню Internet Explorer пункт &quot;Copy (as plain text;)&quot;
&#039; ----------------------------------------------------------------------------------------

Dim sMenu, REG_MENUEXT, rc
&#039;--- имя добавляемого пункта
sMenu = &quot;Copy (as plain text;)&quot; &#039;имя добавляемого пункта

REG_MENUEXT = &quot;HKCU\Software\Microsoft\Internet Explorer\MenuExt\&quot; &#039; путь к меню Internet Explorer в реестре

Set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)
Set FSO = WScript.CreateObject(&quot;Scripting.FileSystemObject&quot;)

&#039;--- проверка наличия в IE нашего пункта&#039;
If uf_keyExists( REG_MENUEXT &amp; sMenu &amp; &quot;\&quot; ) Then 
	&#039;--- менюшка уже есть, предлагаем удалить&#039;
	rc=MsgBox(&quot;Удалять из меню Internet Explorer данный пункт ?&quot; &amp; vbCrLf , vbQuestion + vbOKCancel, sMenu)
	If rc=vbOK Then
		WshShell.RegDelete( REG_MENUEXT &amp; sMenu &amp; &quot;\&quot; )
		MsgBox &quot;Удаление выполнено.&quot; &amp; vbCrLf &amp;_
			&quot;Перезапустите Internet Explorer, чтобы изменения вступили в силу&quot; &amp; vbCrLf &amp; vbCrLf, _
			vbInformation, &quot;Удаление в IE меню &quot;&quot;&quot; &amp; sMenu &amp; &quot;&quot;&quot;&quot;
	End IF
else &#039;--- пункта меню нет, предлагаем установить&#039;
	rc = MsgBox(&quot;Хотите добавить в контекстное меню Internet Explorer пункт &quot;&quot;&quot; &amp; sMenu &amp; &quot;&quot;&quot;&quot; &amp; vbCrLf &amp; vbCrLf &amp; _
		&quot;для возможности копирования в IE выделения как простого текста (plain text) ?&quot; &amp; vbCrLf &amp; vbCrLf, _
		vbYesNo OR vbQuestion, &quot;Установка &quot;&quot;&quot; &amp; sMenu &amp; &quot;&quot;&quot;&quot;)
	If rc=vbYes Then
		Dim sPathApp, sPathHTM, REG_NEWMENU
		sPathApp = fso.GetAbsolutePathName(&quot;.&quot;) &#039;путь к каталогу запуска задачи&#039;
		sPathHTM = sPathApp &amp; &quot;\IE_copyAsText.htm&quot; &#039;путь к программе добавления ссылок&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;
		&#039; Записываем в реестр требуемые значения
		REG_NEWMENU = REG_MENUEXT &amp; sMenu &amp; &quot;\&quot;
		WshShell.RegWrite REG_NEWMENU, sPathHTM, &quot;REG_SZ&quot;
		WshShell.RegWrite REG_NEWMENU &amp; &quot;Contexts&quot;, 8+16+32, &quot;REG_DWORD&quot; &#039;Таблица 0x8 + Выделенный текст 0x10 + Ссылка 0x20&#039;
		WshShell.RegWrite REG_NEWMENU &amp; &quot;Flags&quot;,    1, &quot;REG_DWORD&quot;
		MsgBox &quot;Данные были успешно внесены,&quot; &amp; vbCrLf &amp; _
			&quot;путь к программе прописан следующий - &quot;&quot;&quot;&amp;sPathHTM&amp;&quot;&quot;&quot;.&quot; &amp; vbCrLf &amp; vbCrLf &amp; _
			&quot;Перезапустите Internet Explorer, чтобы изменения вступили в силу, &quot; &amp;_
			&quot;добавленный пункт будет отображаться в контекстном меню.&quot; &amp; vbCrLf &amp;vbCrLf,_
			vbInformation, sMenu
	End IF
End If

Set FSO = Nothing
Set WshShell = Nothing


&#039;--- проверка наличия ключа реестра&#039;
Function uf_keyExists(key)
  Dim key2    
  On Error Resume Next
  key2 = WshShell.RegRead(key)
  If Err &lt;&gt; 0 Then
    uf_keyExists = False
  Else
    uf_keyExists = True
  End If
  On Error GoTo 0
End Function</code></pre></div><p>Код страницы со скриптом:<br /></p><div class="codebox"><pre><code>
&lt;!-- IE_copyAsText.htm
Данная страничка выполняет копирование в clipboard выделенного на странице содержимого как простого текста.

Меню вызова этой страницы настраивается запуском скрипта - &quot;IE_copyAsText_setup.vbs&quot;. 
--&gt;

&lt;html style=&quot;width: 300px; height: 160px; margin: 1px; status:1&quot;&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1251&quot;&gt;
&lt;meta name=&quot;Author&quot; content=&quot;Roman.Gerashchenko@otpbank.com.ua&quot;&gt;
&lt;meta name=&quot;Description&quot; content=&quot;Copy selected content in IE as plain text&quot;&gt;

&lt;head&gt;
&lt;title&gt;as plain text&lt;/title&gt;
&lt;/head&gt;

&lt;!-- ========================================= HTML ===========================================  --&gt;

&lt;BODY BGCOLOR=&quot;#C0C0C0&quot; onload=&quot;Window_OnLoad();&quot;&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;TEXTAREA id=ta_textResult rows=5 cols=40
	style=&quot;font-size: 10;&quot;&gt;
&lt;/TEXTAREA&gt;

&lt;/div&gt;
&lt;br&gt;&lt;br&gt;
&lt;hr&gt;&lt;small&gt;
&lt;i&gt;&amp;nbsp;IE_copyAsText.htm v1.0 by 05.09.2012 &amp;nbsp;&amp;copy; R.G.&lt;/i&gt;&lt;/small&gt;
&lt;!-- ====================================== VBScript ==========================================  --&gt;
&lt;script language=&quot;VBScript&quot;&gt;

&#039;/-/-/-/-/-/-/-/-/-/ Вспом. функции - для вызова из JScript некоторых возможностей VBScript /-/-/-/-/-/-/&#039;
Function vb_Trim (ps)
	vb_Trim = RTrim( LTrim(ps) ) &#039;почему-то одной функции Trim() не достаточно!:(&#039; 
End Function 


&lt;/script&gt;

&lt;!-- =================================== JScript ==============================================  --&gt;
&lt;script language=&quot;JavaScript&quot;&gt;

// отрабатывает при открытии окна - получение значений из &quot;вызвавшей&quot; страницы
function Window_OnLoad()
{
	var parentwin = external.menuArguments;     // получаем объект окна
	var doc = parentwin.document;               // получаем объект документа
	
	
	var sel = &quot;&quot;;
	sel = doc.selection.createRange().text; // получаем текст выделения
	sel = vb_Trim( sel ); // отсекаем лидирующие и конечные пробелы
	
	if (sel==&quot;&quot;) alert(&quot;На странице не было выделения непустого текстового содержимого&quot;); else {
		document.all.ta_textResult.value = sel; // вставляем полученный текст в объект TEXTAREA
		ta_textResult.createTextRange().execCommand(&quot;Copy&quot;); //копируем в clipboard
	}
	
	 // alert(&quot;Close&quot;);
	window.close();
}

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre></div><p>Можно скачать mp4-клип - &quot;мануал&quot; <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> <a href="https://code.google.com/p/small-scripts/downloads/detail?name=IE_copyAsText_VIDEO_MANUAL.mp4&amp;can=2&amp;q=">https://code.google.com/p/small-scripts … n=2&amp;q=</a></p>]]></description>
			<author><![CDATA[null@example.com (Rom5)]]></author>
			<pubDate>Wed, 05 Sep 2012 13:04:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63535#p63535</guid>
		</item>
	</channel>
</rss>
