<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; VBScript: InternetExplorer.Application, работа с фреймами]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=1032</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=1032&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «VBScript: InternetExplorer.Application, работа с фреймами».]]></description>
		<lastBuildDate>Thu, 10 Jan 2008 20:28:49 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: VBScript: InternetExplorer.Application, работа с фреймами]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=7814#p7814</link>
			<description><![CDATA[<p>Пример загрузки во фрейм нового содержимого. В примере создаётся страница с фреймом &quot;frame1&quot; и через 10 сек. содержимое этого фрейма перезагружается:<br /></p><div class="codebox"><pre><code>Set IE = CreateObject(&quot;InternetExplorer.Application&quot;)
IE.Navigate(&quot;about:blank&quot;)
While IE.Busy
    WScript.Sleep 100
Wend
IE.Document.body.innerHTML= _
  &quot;Этот текст останется, а фрейм будет перезагружен.&lt;BR&gt;&quot; &amp; _
  &quot;&lt;IFRAME name=&#039;frame1&#039; src=&#039;http://forum.script-coding.com/&#039;&gt;&lt;/IFRAME&gt;&quot;
IE.Visible=True
WScript.Sleep 10000
IE.Navigate &quot;http://forum.script-coding.com/rules.html&quot;, undefined, &quot;frame1&quot;</code></pre></div><p>То же самое вполне работает и с &quot;чужими&quot; страницами:<br /></p><div class="codebox"><pre><code>Set IE=CreateObject(&quot;InternetExplorer.Application&quot;)
IE.Visible=True
IE.Navigate &quot;http://www.demogorgon.ru/&quot;
WScript.Sleep 10000
IE.Navigate &quot;http://forum.script-coding.com/&quot;, Null, &quot;mainFrame&quot;</code></pre></div><p>Автор примеров - <strong>wisgest</strong>.</p>]]></description>
			<author><![CDATA[null@example.com (The gray Cardinal)]]></author>
			<pubDate>Thu, 10 Jan 2008 20:28:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=7814#p7814</guid>
		</item>
		<item>
			<title><![CDATA[VBScript: InternetExplorer.Application, работа с фреймами]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=7812#p7812</link>
			<description><![CDATA[<p>Пример демонстрирует возможность получения HTML кода фреймов загруженной страницы.<br /></p><div class="codebox"><pre><code>Dim InternetExplorer
&#039;/// Создаём экземпляр нового класса
Set InternetExplorer = New InternetExplorerClass
&#039;/// Делаем IE видимым
InternetExplorer.Application.Visible = True

InternetExplorer.Application.Navigate &quot;http://www.myshkin.ru/frameset.htm&quot;

&#039;// Описываем события
Sub InternetExplorer_DocumentComplete(pDisp, URL)

    &#039;/// Т.к в это событие сваливается загрузка каждого HTMLWindow, то ждём пока не загрузиться наше главное окно    
    if InternetExplorer.Application.LocationURL &lt;&gt; URL Then Exit Sub
    
    &#039;/// Получаем ссылку на сам документ
    Set Document = pDisp.Document
    &#039;/// Получаем объект родительского окна
    Set Window = Document.parentWindow

    &#039;/// Подсчитываем колличество фреймов
    Dim FramesCount

    FramesCount = Window.Frames.length

    &#039;/// Если фрейм один или их несколько
    If FramesCount &gt; 0 Then
        MsgBox &quot;В странице найдено &quot; &amp; FramesCount &amp; &quot; фреймов&quot;,vbInformation
        &#039;/// Перебираем фреймы по ID
        For FrameID = 0 to Window.Frames.Length-1
            &#039;/// Получаем фрейм как объект
            Set Frame = Window.Frames(FrameID)
            &#039;/// Возвращаем содержимое его документа в сообщение
            MsgBox Frame.Document.body.outerhtml,vbInformation,&quot;Содержимое фрейма &quot; &amp; FrameID
        Next
    Else
    &#039;/// Если фреймов нет
        MsgBox &quot;В странице не найдено фреймов&quot;,vbExclamation
    End if
End Sub

Sub InternetExplorer_OnQuit()
    MsgBox &quot;Вы закрыли Internet Explorer&quot;,vbInformation,&quot;Internet Explorer&quot;
    Wscript.Quit
End Sub

&#039;/// Класс модуль InternetExplorer
Class InternetExplorerClass
    Public Application

    Private Sub Class_Initialize
        &#039;/// Вся идея в создании объекта через WScript. Вторым параметром указывается префикс функций-обработчиков событий
        Set Application = WScript.CreateObject(&quot;InternetExplorer.Application&quot;, &quot;InternetExplorer_&quot;)
    End Sub

    Sub Class_Terminate
        &#039;/// Для того, чтобы WScript не завершил выполнение сценария при попытке уничтожить модуль,
        &#039;/// делаем цикл, который завершается, если объект IE перестал существовать.
        Do
            WScript.Sleep 10
        Loop Until Application = &quot;&quot;
    End Sub
End Class</code></pre></div><p>Автор примера - <strong>Xameleon</strong>.</p>]]></description>
			<author><![CDATA[null@example.com (The gray Cardinal)]]></author>
			<pubDate>Thu, 10 Jan 2008 20:20:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=7812#p7812</guid>
		</item>
	</channel>
</rss>
