<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: IE COM Multi URL]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=14283</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=14283&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: IE COM Multi URL».]]></description>
		<lastBuildDate>Tue, 02 Apr 2019 19:00:29 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=133301#p133301</link>
			<description><![CDATA[<div class="codebox"><pre><code>
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
#SingleInstance force 

ie := ComObjCreate(&quot;InternetExplorer.Application&quot;)
ie.Visible := true
ie.Navigate(&quot;https://www.google.com&quot;)
ie.Navigate(&quot;https://yandex.ru&quot;,2048)



w::
 ie := WBFromUrl(&quot;https://www.google.com/&quot;)
 
 MsgBox % ie.document.getElementsByTagName(&quot;input&quot;)[1].value
 return
 
q::
 ie2 := WBFromUrl(&quot;https://yandex.ru/&quot;)
  MsgBox % ie2.document.getElementsByTagName(&quot;input&quot;)[1].value
 return
 
 
 
 WBFromUrl(url)  {
   shell := ComObjCreate(&quot;Shell.Application&quot;)
   loop  {
      for window in shell.Windows  {
         if (window.LocationUrl = url)
            break 2
      }
      Sleep 10
   }
   Return window
}
</code></pre></div><p>а возможно ли через хром сделать такое? </p><div class="codebox"><pre><code>

driver := ComObjCreate(&quot;Selenium.ChromeDriver&quot;)
driver.AddArgument(&quot;--disable-infobars&quot;)
driver.AddArgument(&quot;--start-maximized&quot;) 

driver.Get(&quot;https://www.google.com&quot;)

driver.ExecuteScript(&quot;window.open();&quot;)
driver.SwitchToNextWindow
driver.Get(&quot;https://yandex.ru&quot;)


w::

;&quot;https://www.google.com&quot;

 MsgBox %  driver.findElementsByTag(&quot;input&quot;).item[2].Attribute(&quot;value&quot;)
 return
 
q::

; &quot;https://yandex.ru&quot;
   MsgBox % driver.findElementsByTag(&quot;input&quot;).item[2].Attribute(&quot;value&quot;)
 return


</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Tue, 02 Apr 2019 19:00:29 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=133301#p133301</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129544#p129544</link>
			<description><![CDATA[<p>Наверняка можно получать результаты через WinHttpRequest.<br />Можете поискать - на форуме много где обсуждалось.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 29 Oct 2018 13:43:06 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129544#p129544</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129543#p129543</link>
			<description><![CDATA[<p><strong>Malcev</strong></p><p>Скорее всего, да, т.к. идёт ручной поиск в 4-х базах, после чего найденный результат нужно заносить в excel для отчётности</p>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Mon, 29 Oct 2018 13:32:08 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129543#p129543</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129542#p129542</link>
			<description><![CDATA[<p><strong>inseption86</strong>, а есть ли вообще смысл для вашей задачи использовать IE?</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 29 Oct 2018 12:40:34 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129542#p129542</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129540#p129540</link>
			<description><![CDATA[<p>Если не используете OnExit, то в ieArr.Push(ie) смысла нет.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Mon, 29 Oct 2018 10:02:10 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129540#p129540</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129539#p129539</link>
			<description><![CDATA[<p><strong>teadrinker</strong><br />Спасибо большое! Вроде бы вот так:</p><div class="codebox"><pre><code>
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force   ; игнор уже запущенного скрипта, переоткрытие

FileSelectFile, Path, 3, , Open Excel File, Excel File (*.xls; *.xlsx)
IF path =
	ExitApp
Xl := ComObjCreate(&quot;Excel.Application&quot;)
Xl.Visible := true
Xl.Workbooks.Open(Path)

FormatTime, TimeString, , dd.MM.yyyy
Xl.Range(&quot;A1&quot;).value := Xl.Range(&quot;A1&quot;).value &quot; &quot; Timestring
Xl.Range(&quot;B1&quot;).value := Xl.Range(&quot;B1&quot;).value &quot; &quot; Timestring
Xl.Range(&quot;C1&quot;).value := Xl.Range(&quot;C1&quot;).value &quot; &quot; Timestring
Xl.Range(&quot;D1&quot;).value := Xl.Range(&quot;D1&quot;).value &quot; &quot; Timestring

ieArr := []
ie := ComObjCreate(&quot;InternetExplorer.Application&quot;)
ieArr.Push(ie)
ie.Visible := true

ie.Navigate(&quot;https://1.ru&quot;)
ie.Navigate(&quot;https://2.ru&quot;,2048)
ie.Navigate(&quot;http://3&quot;,2048)
ie.Navigate(&quot;http://4&quot;,2048)



Gui, +ToolWindow +AlwaysOnTop 

Gui, Font, s12 italic 

Gui, Add, text,x30, 1
Gui, Add, text,x+60, 2
Gui, Add, text,x+65, 3
Gui, Add, text,x+70, 4
Gui, Font,  normal

Gui, Add, Button, -TabStop x5 y+10 w40 h40 g11, +


Gui, Add, Button, -TabStop x+40 y+-40 w40 h40 g21, +


Gui, Add, Button, -TabStop x+40 y+-40 w40 h40 g31 , +


Gui, Add, Button, -TabStop x+40 y+-40 w40 h40 g41 , +

Gui, Show, x600 y100 w300 h110, Proverka
Return



; здесь &quot;https://1.ru&quot;
g11:

ie := WBFromUrl(&quot;https://1.ru&quot;)
ieArr.Push(ie)

xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Rows.Count, &quot;A&quot;).End(xlUp := -4162).Row + 1, &quot;A&quot;).value:= ie.document.getElementsByTagName(&quot;input&quot;)[2].value 

; здесь &quot;https://2.ru&quot;
g21:

ie2 := WBFromUrl(&quot;https://2.ru&quot;)
ieArr.Push(ie2)

xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Rows.Count, B&quot;).End(xlUp := -4162).Row + 1, &quot;B&quot;).value:= ie2.document.getElementsByTagName(&quot;input&quot;)[0].value

; здесь &quot;https://3.ru&quot;
g31:

ie3 := WBFromUrl(&quot;https://3.ru&quot;)
ieArr.Push(ie3)

xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Rows.Count, C&quot;).End(xlUp := -4162).Row + 1, &quot;C&quot;).value:= ie3.document.getElementsByTagName(&quot;input&quot;)[0].value

; здесь &quot;https://4.ru&quot;
g41:

ie4 := WBFromUrl(&quot;https://4.ru&quot;)
ieArr.Push(ie4)

xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Rows.Count, D&quot;).End(xlUp := -4162).Row + 1, &quot;D&quot;).value:= ie.document.getElementsByTagName(&quot;input&quot;)[1].value


WBFromUrl(url)  {
   shell := ComObjCreate(&quot;Shell.Application&quot;)
   loop  {
      for window in shell.Windows  {
         if (window.LocationUrl = url)
            break 2
      }
      Sleep 10
   }
   Return window
}



</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Mon, 29 Oct 2018 09:59:23 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129539#p129539</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129538#p129538</link>
			<description><![CDATA[<p>Вам нужно для каждого url, открытого в новой вкладке, получить свой объект IE, как в примере ниже для вкладки с адресом этой страницы:<br /></p><div class="codebox"><pre><code>ieArr := []
ie := ComObjCreate(&quot;InternetExplorer.Application&quot;)
ieArr.Push(ie)
OnExit( Func(&quot;IeQuit&quot;).Bind(ieArr) )
ie.Visible := true

ie.Navigate(&quot;https://autohotkey.com/boards/index.php?style=17&quot;)
ie.Navigate(&quot;http://forum.script-coding.com/viewtopic.php?pid=129526#p129526&quot;, 2048)

; получаем объект IE для новой вкладки
ie2 := WBFromUrl(&quot;http://forum.script-coding.com/viewtopic.php?pid=129526#p129526&quot;)
ieArr.Push(ie2)
; для получения информации с новой вкладки используем соответствующий ей объект IE
codeBoxes := ie2.document.getElementsByTagName(&quot;code&quot;)
MsgBox,, My Code, % codeBoxes[4].innerHtml

WBFromUrl(url)  {
   shell := ComObjCreate(&quot;Shell.Application&quot;)
   loop  {
      for window in shell.Windows  {
         if (window.LocationUrl = url)
            break 2
      }
      Sleep 10
   }
   Return window
}

IeQuit(arr)  {
   for k, ie in arr
      try ie.Quit()
}</code></pre></div><div class="quotebox"><cite>inseption86 пишет:</cite><blockquote><p>ie.Navigate(&quot;https://2.ru&quot;,2048) - не выполянется</p></blockquote></div><p>Ну, открывайте этот url в основной вкладке.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Mon, 29 Oct 2018 09:32:39 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129538#p129538</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129536#p129536</link>
			<description><![CDATA[<p>Добрый день! Что то я туговат и не разобрался.<br />Мой код:</p><div class="codebox"><pre><code>
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force   ; игнор уже запущенного скрипта, переоткрытие

FileSelectFile, Path, 3, , Open Excel File, Excel File (*.xls; *.xlsx)
IF path =
	ExitApp
Xl := ComObjCreate(&quot;Excel.Application&quot;)
Xl.Visible := true
Xl.Workbooks.Open(Path)

FormatTime, TimeString, , dd.MM.yyyy
Xl.Range(&quot;A1&quot;).value := Xl.Range(&quot;A1&quot;).value &quot; &quot; Timestring
Xl.Range(&quot;B1&quot;).value := Xl.Range(&quot;B1&quot;).value &quot; &quot; Timestring
Xl.Range(&quot;C1&quot;).value := Xl.Range(&quot;C1&quot;).value &quot; &quot; Timestring
Xl.Range(&quot;D1&quot;).value := Xl.Range(&quot;D1&quot;).value &quot; &quot; Timestring

ie := ComObjCreate(&quot;InternetExplorer.Application&quot;)
ie.Visible := true
ie.Navigate(&quot;https://1.ru&quot;)
ie.Navigate(&quot;https://2.ru&quot;,2048)
ie.Navigate(&quot;http://3&quot;,2048)
ie.Navigate(&quot;http://4&quot;,2048)

while ie.readystate &lt;&gt; 4
	continue

Gui, +ToolWindow +AlwaysOnTop 

Gui, Font, s12 italic 

Gui, Add, text,x30, 1
Gui, Add, text,x+60, 2
Gui, Add, text,x+65, 3
Gui, Add, text,x+70, 4
Gui, Font,  normal

Gui, Add, Button, -TabStop x5 y+10 w40 h40 g11, +


Gui, Add, Button, -TabStop x+40 y+-40 w40 h40 g21, +


Gui, Add, Button, -TabStop x+40 y+-40 w40 h40 g31 , +


Gui, Add, Button, -TabStop x+40 y+-40 w40 h40 g41 , +

Gui, Show, x600 y100 w300 h110, Proverka
Return



; здесь &quot;https://1.ru&quot;
g11:
xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Rows.Count, &quot;A&quot;).End(xlUp := -4162).Row + 1, &quot;A&quot;).value:= ie.document.getElementsByTagName(&quot;input&quot;)[2].value 

; здесь &quot;https://2.ru&quot;
g21:
xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Rows.Count, B&quot;).End(xlUp := -4162).Row + 1, &quot;B&quot;).value:= ie.document.getElementsByTagName(&quot;input&quot;)[0].value

; здесь &quot;https://3.ru&quot;
g31:
xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Rows.Count, C&quot;).End(xlUp := -4162).Row + 1, &quot;C&quot;).value:= ie.document.getElementsByTagName(&quot;input&quot;)[0].value

; здесь &quot;https://4.ru&quot;
g41:
xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Cells.(xl.Worksheets(&quot;Лист&quot;).Rows.Count, D&quot;).End(xlUp := -4162).Row + 1, &quot;D&quot;).value:= ie.document.getElementsByTagName(&quot;input&quot;)[1].value

</code></pre></div><p>Еще проблема в том, что, например, ie.Navigate(&quot;https://2.ru&quot;,2048) - не выполянется &quot;.....value:= ie.document.getElementsByTagName(&quot;input&quot;)[0].value&quot;, если убрать &quot;2048&quot;, то всё ОК</p>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Mon, 29 Oct 2018 07:22:27 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129536#p129536</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129532#p129532</link>
			<description><![CDATA[<p>Всем спасибо! Завтра попробую.</p>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Sun, 28 Oct 2018 19:17:11 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129532#p129532</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129530#p129530</link>
			<description><![CDATA[<p>Ну, можно и так, слегка перемудрил <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 28 Oct 2018 19:07:46 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129530#p129530</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129529#p129529</link>
			<description><![CDATA[<p>Как-то сложно.<br /></p><div class="codebox"><pre><code>shell := ComObjCreate(&quot;Shell.Application&quot;)

ie := ComObjCreate(&quot;InternetExplorer.Application&quot;)
ie.Visible := true
ie.Navigate(&quot;https://1.com&quot;)
ie.Navigate(&quot;https://2.com&quot;,2048)
ie.Navigate(&quot;https://2.com/?test&quot;,2048)
loop
{
   for window in shell.Windows
   {
      if (window.LocationUrl = &quot;https://2.com/?test&quot;)
      {
         ie2 := window
         break 2
      }
   }
}
ie2.Navigate(&quot;google.com&quot;)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sun, 28 Oct 2018 18:24:10 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129529#p129529</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129527#p129527</link>
			<description><![CDATA[<p>Каждая страница, открытая в новой вкладке, имеет свой отдельный объект InternetExplorer; чтобы работать с новой вкладкой, нужно получить связанный с ней объект. Например, можно вот так по url:<br /></p><div class="codebox"><pre><code>ieArr := []
ie := ComObjCreate(&quot;InternetExplorer.Application&quot;)
ieArr.Push(ie)
OnExit( Func(&quot;IeQuit&quot;).Bind(ieArr) )
ie.Visible := true

ie.Navigate(&quot;https://autohotkey.com/boards/index.php?style=17&quot;)
ie.Navigate(&quot;http://forum.script-coding.com/viewtopic.php?pid=129526#p129526&quot;, 2048)
while ie.busy
   continue

ie2 := WBFromUrl(ie.hwnd, &quot;http://forum.script-coding.com/viewtopic.php?pid=129526#p129526&quot;)
ieArr.Push(ie2)

codeBoxes := ie2.document.getElementsByTagName(&quot;code&quot;)
MsgBox,, My Code, % codeBoxes[1].innerHtml

WBFromUrl(hWndIE, url)  {
   static VT_DISPATCH := 9, F_OWNVALUE := 1
        , IID_IWebBrowserApp := &quot;{0002DF05-0000-0000-C000-000000000046}&quot;
        
   for window in ComObjCreate(&quot;Shell.Application&quot;).Windows  {
      if (window.hwnd = hWndIE &amp;&amp; window.document.parentWindow.location.href = url) {
         doc := window.document
         break
      }
   }
   pdoc := ComObjUnwrap(doc)
   oWb := ComObject(VT_DISPATCH, ComObjQuery(pdoc, IID_IWebBrowserApp, IID_IWebBrowserApp), F_OWNVALUE)
   ObjRelease(pdoc)
   Return oWb
}

IeQuit(arr)  {
   for k, ie in arr
      try ie.Quit()
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 28 Oct 2018 18:04:37 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129527#p129527</guid>
		</item>
		<item>
			<title><![CDATA[AHK: IE COM Multi URL]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=129526#p129526</link>
			<description><![CDATA[<p>Добрый день! Подскажите пож-та, имеются несколько сайтов для работы, возможно ли их разграничить по &quot;ie.document.getElementsByTagName(&quot;input&quot;)[2].value&quot;, не знаю, как правильно объяснить, может пример поможет:</p><br /><br /><div class="codebox"><pre><code>ie := ComObjCreate(&quot;InternetExplorer.Application&quot;)
ie.Visible := true
ie.Navigate(&quot;https://1.com&quot;)
ie.Navigate(&quot;https://2.com,2048)
ie.Navigate(&quot;https://3.com&quot;,2048)
ie.Navigate(&quot;https://4.com&quot;,2048)
while ie.readystate &lt;&gt; 4
	continue
sleep 100

;https://1.com
msgbox % ie.document.getElementsByTagName(&quot;input&quot;)[2].value

;https://2.com
msgbox % ie.document.getElementsByTagName(&quot;input&quot;)[2].value 

;https://3.com
msgbox % ie.document.getElementsByTagName(&quot;input&quot;)[2].value 

;https://4.com

msgbox % ie.document.getElementsByTagName(&quot;input&quot;)[2].value </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Sun, 28 Oct 2018 11:57:37 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=129526#p129526</guid>
		</item>
	</channel>
</rss>
