<?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 object ?]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=7943</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7943&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Как активировать вкладку IE через com object ?».]]></description>
		<lastBuildDate>Sat, 05 Jan 2013 01:19:13 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Как активировать вкладку IE через com object ?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=68158#p68158</link>
			<description><![CDATA[<p>Объект <a href="http://msdn.microsoft.com/en-us/library/aa752084%28VS.85%29.aspx">InternetExplorer</a> <a href="http://msdn.microsoft.com/en-us/library/aa768399%28VS.85%29.aspx"><em>не даёт</em></a> возможности перемещаться по вкладкам, можно только открыть URL в новой или в текущей вкладке (если я не прав, пусть кто-то меня поправит).</p><p>Для решения этой задачи можно использовать <a href="http://msdn.microsoft.com/ru-ru/library/windows/desktop/dd318466">IAccessible interface</a> контролов вкладок. Следующий пример инспектирует окна IE на предмет вкладки, содержащей в адресе &quot;yandex.ru&quot;, и если находит, то активирует её.<br /></p><div class="codebox"><pre><code>Domen := &quot;yandex.ru&quot;

For Wb in ComObjCreate(&quot;Shell.Application&quot;).Windows
   If InStr(Wb.FullName, &quot;iexplore.exe&quot;) and InStr(wb.LocationUrl, Domen)
      hIE := Wb.hwnd, Wb := &quot;&quot;
until hIE

if !hIE
{
   MsgBox, Вкладка не найдена!
   return
}

WinGet, ControlList, ControlList, ahk_id %hIE%

ControlName := RegExReplace(ControlList, &quot;is).*(DirectUIHWND\d+).*&quot;, &quot;$1&quot;)
ControlGet, hwnd, hwnd,, % ControlName, ahk_id %hIE%

Tabs := Acc_ObjectFromWindow(hwnd).accChild(1)

Loop % Tabs.accChildCount
   if InStr(Tabs.accChild(A_Index).accDescription(0), Domen)
   {
      WinActivate, ahk_id %hIE%
      Tabs.accChild(A_Index).accDoDefaultAction(0), Tabs := &quot;&quot;
      break
   }
return

Acc_ObjectFromWindow(hWnd, idObject = -4)
{
   If   DllCall(&quot;oleacc\AccessibleObjectFromWindow&quot;, &quot;Ptr&quot;, hWnd, &quot;UInt&quot;, idObject&amp;=0xFFFFFFFF, &quot;Ptr&quot;, -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,&quot;Int64&quot;),&quot;Int64&quot;), &quot;Ptr*&quot;, pacc)=0
      Return   ComObjEnwrap(9,pacc,1)
}</code></pre></div><p>Информация: <a href="http://www.autohotkey.com/board/topic/77303-acc-library-ahk-l-updated-09272012/">Acc Library</a></p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 05 Jan 2013 01:19:13 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=68158#p68158</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Как активировать вкладку IE через com object ?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=68152#p68152</link>
			<description><![CDATA[<p>Доброе время суток знатоки! <br />Как цепляться ComObj-ектом к уже открытому&nbsp; окну \вкладке IE разобрался, а вот как активировать вкладку к которой прицепился&nbsp; ComObj-ектом не могу разобраться (при условии что открыто несколько окон IE, а в них по несколько вкладок). Подскажите пожалуйста.<br /></p><div class="codebox"><pre><code>Numpad3::

Domen := &quot;yandex.ru&quot; ;

    For Wb in ComObjCreate(&quot;Shell.Application&quot;).Windows ; 
       If InStr(Wb.FullName, &quot;iexplore.exe&quot; ) and InStr(wb.LocationUrl, &quot;%Domen%&quot; ) ;    
        {              
          ...В этом месте как то нужно активировать и развернуть эту вкладку....          
          break
        }

          LocUrl := wb.LocationURL
          LocName := wb.LocationName        
        
msgbox, % LocUrl &quot;`n&quot; LocName</code></pre></div><p>Через JetTitle c WinActivate - не подходит, потому как страницы могут иметь одинаковое имя.</p>]]></description>
			<author><![CDATA[null@example.com (shnec)]]></author>
			<pubDate>Fri, 04 Jan 2013 19:08:37 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=68152#p68152</guid>
		</item>
	</channel>
</rss>
