<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Получить ссылку из неактивного окна браузера]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=11998</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11998&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Получить ссылку из неактивного окна браузера».]]></description>
		<lastBuildDate>Sat, 04 Feb 2017 03:09:31 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=111837#p111837</link>
			<description><![CDATA[<p>Оказалось, мешала строка в моём коде:</p><div class="codebox"><pre><code>DetectHiddenWindows, on</code></pre></div><p>Перед действием её можно отключать (off), а потом включать.</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Sat, 04 Feb 2017 03:09:31 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=111837#p111837</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=111082#p111082</link>
			<description><![CDATA[<p>Не могу понять, по какой причине приведенный ниже код отдельно работает, но если запускать из моего постоянного скрипта, со множеством меток, по горячей клавише выводит пустое окно? —<br /></p><div class="codebox"><pre><code>
f6::
	;nTime := A_TickCount
	WinGetClass, sClass, A
	URL := GetBrowserURL(sClass)
	MsgBox, % URL
Return


GetBrowserURL(sClass) {
	Static AccBrowsersClass := &quot;MozillaWindowClass,Chrome_WidgetWin_0,Chrome_WidgetWin_1,Maxthon3Cls_MainFrm,Slimjet_WidgetWin_1&quot;
	Static DDEBrowsersClass := &quot;MozillaWindowClass,IEFrame,OperaWindowClass&quot;
	If sClass In % AccBrowsersClass
		Return GetBrowserURL_ACC(sClass)
	Else If sClass In % DDEBrowsersClass
		Return GetBrowserURL_DDE(sClass)
}
GetBrowserURL_DDE(sClass) {
	WinGet, sServer, ProcessName, % &quot;ahk_class &quot; sClass
	StringTrimRight, sServer, sServer, 4
	iCodePage := A_IsUnicode ? 0x04B0 : 0x03EC ; 0x04B0 = CP_WINUNICODE, 0x03EC = CP_WINANSI
	DllCall(&quot;DdeInitialize&quot;, &quot;UPtrP&quot;, idInst, &quot;Uint&quot;, 0, &quot;Uint&quot;, 0, &quot;Uint&quot;, 0)
	hServer := DllCall(&quot;DdeCreateStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;Str&quot;, sServer, &quot;int&quot;, iCodePage)
	hTopic := DllCall(&quot;DdeCreateStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;Str&quot;, &quot;WWW_GetWindowInfo&quot;, &quot;int&quot;, iCodePage)
	hItem := DllCall(&quot;DdeCreateStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;Str&quot;, &quot;0xFFFFFFFF&quot;, &quot;int&quot;, iCodePage)
	hConv := DllCall(&quot;DdeConnect&quot;, &quot;UPtr&quot;, idInst, &quot;UPtr&quot;, hServer, &quot;UPtr&quot;, hTopic, &quot;Uint&quot;, 0)
	hData := DllCall(&quot;DdeClientTransaction&quot;, &quot;Uint&quot;, 0, &quot;Uint&quot;, 0, &quot;UPtr&quot;, hConv, &quot;UPtr&quot;, hItem, &quot;UInt&quot;, 1, &quot;Uint&quot;, 0x20B0, &quot;Uint&quot;, 10000, &quot;UPtrP&quot;, nResult) ; 0x20B0 = XTYP_REQUEST, 10000 = 10s timeout
	sData := DllCall(&quot;DdeAccessData&quot;, &quot;Uint&quot;, hData, &quot;Uint&quot;, 0, &quot;Str&quot;)
	DllCall(&quot;DdeFreeStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;UPtr&quot;, hServer)
	DllCall(&quot;DdeFreeStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;UPtr&quot;, hTopic)
	DllCall(&quot;DdeFreeStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;UPtr&quot;, hItem)
	DllCall(&quot;DdeUnaccessData&quot;, &quot;UPtr&quot;, hData)
	DllCall(&quot;DdeFreeDataHandle&quot;, &quot;UPtr&quot;, hData)
	DllCall(&quot;DdeDisconnect&quot;, &quot;UPtr&quot;, hConv)
	DllCall(&quot;DdeUninitialize&quot;, &quot;UPtr&quot;, idInst)
	csvWindowInfo := StrGet(&amp;sData, &quot;CP0&quot;)
	StringSplit, sWindowInfo, csvWindowInfo, `&quot; ;&quot;; comment to avoid a syntax highlighting issue in autohotkey.com/boards
	Return sWindowInfo2
}
GetBrowserURL_ACC(sClass) {
	static nWindow, accAddressBar
	If (nWindow != WinExist(&quot;ahk_class &quot; sClass)) ; reuses accAddressBar if it&#039;s the same window
	{
		nWindow := WinExist(&quot;ahk_class &quot; sClass)
		accAddressBar := GetAddressBar(Acc_ObjectFromWindow(nWindow))
	}
	Try sURL := accAddressBar.accValue(0)
	If (sURL == &quot;&quot;) {
		WinGet, nWindows, List, % &quot;ahk_class &quot; sClass ; In case of a nested browser window as in the old CoolNovo (TO DO: check if still needed)
		If (nWindows &gt; 1) {
			accAddressBar := GetAddressBar(Acc_ObjectFromWindow(nWindows2))
			Try sURL := accAddressBar.accValue(0)
		}
	}
	If (sURL == &quot;&quot;)
		nWindow := -1 ; Don&#039;t remember the window if there is no URL
	Return sURL
}
GetAddressBar(accObj, accPath:=&quot;&quot;) {
	; static a:=0
	; ToolTip % a++ ; 360 for firefox, 47 for modern Opera
	n := 0
	Try If ((accObj.accRole(0) == 42) and accObj.accValue(0))
		Return accObj
	For nChild, accChild in Acc_Children(accObj) {
		n++
		currentPath := accPath n &quot;.&quot;
		;ToolTip % currentPath
		If IsObject(accAddressBar := GetAddressBar(accChild, currentPath)) {
			Return accAddressBar
		}
	}
}
;~LButton::ToolTip

Acc_Init() {
	static h
	If Not h
		h:=DllCall(&quot;LoadLibrary&quot;,&quot;Str&quot;,&quot;oleacc&quot;,&quot;Ptr&quot;)
}
Acc_ObjectFromWindow(hWnd, idObject = 0) {
	Acc_Init()
	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)
}
Acc_Query(Acc) {
	Try Return ComObj(9, ComObjQuery(Acc,&quot;{618736e0-3c3d-11cf-810c-00aa00389b71}&quot;), 1)
}
Acc_Children(Acc) {
	If ComObjType(Acc,&quot;Name&quot;) != &quot;IAccessible&quot;
		ErrorLevel := &quot;Invalid IAccessible Object&quot;
	Else {
		Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]
		If DllCall(&quot;oleacc\AccessibleChildren&quot;, &quot;Ptr&quot;,ComObjValue(Acc), &quot;Int&quot;,0, &quot;Int&quot;,cChildren, &quot;Ptr&quot;,VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&amp;varChildren, &quot;Int*&quot;,cChildren)=0 {
			Loop %cChildren%
				i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=9?Acc_Query(child):child), NumGet(varChildren,i-8)=9?ObjRelease(child):
			Return Children.MaxIndex()?Children:
		} Else
			ErrorLevel := &quot;AccessibleChildren DllCall Failed&quot;
	}
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Sun, 15 Jan 2017 13:24:33 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=111082#p111082</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=111051#p111051</link>
			<description><![CDATA[<p>Потому что:<br /></p><div class="quotebox"><blockquote><p>На Blink не работает, как и на всех прочих хромоногах.</p></blockquote></div><p>Используйте полный вариант библиотеки по ссылке с 5 поста.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sun, 15 Jan 2017 04:49:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=111051#p111051</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=111049#p111049</link>
			<description><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><div class="codebox"><pre><code>f11::
msgbox % GetBrowserURL_DDE(&quot;MozillaWindowClass&quot;)
...</code></pre></div></blockquote></div><p>Почему, когда запущено две Оперы, с классами &quot;Chrome_WidgetWin_1&quot; и &quot;OperaWindowClass&quot;, при активном первом окне — выводится URL второго?</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Sun, 15 Jan 2017 01:21:41 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=111049#p111049</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107540#p107540</link>
			<description><![CDATA[<p><strong>stealzy</strong>, какое именно окно?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Mon, 12 Sep 2016 09:39:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107540#p107540</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107488#p107488</link>
			<description><![CDATA[<p>А, понял, у меня просто был ещё почтовый клиент thunderbird в это время открыт, он имеет тот же класс.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 11 Sep 2016 18:05:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107488#p107488</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107487#p107487</link>
			<description><![CDATA[<p>Странно. У меня на нескольких компьютерах FF 48.0.2 на win7 работает.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sun, 11 Sep 2016 17:57:13 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107487#p107487</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107484#p107484</link>
			<description><![CDATA[<p><strong>Malcev</strong>, у меня, когда окно FF свёрнуто, скрипт, который ты привёл, выдает пустую строку.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 11 Sep 2016 17:45:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107484#p107484</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107482#p107482</link>
			<description><![CDATA[<p>Круто, спасибо!</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Sun, 11 Sep 2016 15:47:54 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107482#p107482</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107480#p107480</link>
			<description><![CDATA[<p>Мы ведь не про Opera Presto говорим? На Blink не работает, как и на всех прочих хромоногах.<br />По поводу firefox&#039;a - я сам удивился, т.к. в прошлой версии (а она у меня сохранилась :-) он использовал DDE.<br />Почитав ветку, узнал, что последний firefox nightly dde уже вроде не поддерживает.</p><p>Медленно происходит только первый поиск контрола. Потому что сейчас ищется по всем контролам браузера (для firefox он проходит 360 контролов у меня). Со второго раза он быстрее DDE.<br />Я предложил использовать предустановленные пути для старта поиска контролов в <a href="https://autohotkey.com/boards/viewtopic.php?f=6&amp;t=3702&amp;p=109556#p109556">ветке библиотеки</a>, подожду отзывов у какого какие пути - может совсем разные у всех.</p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Sun, 11 Sep 2016 12:50:34 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107480#p107480</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107479#p107479</link>
			<description><![CDATA[<p>Для оперы также должно работать, только класс оперы надо поставить.<br />Свой код я вырезал из той же универсальной библиотеки, только непонятно зачем автор скрипта с фаерфоксом использует ACC, когда через DDE быстрее.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sun, 11 Sep 2016 12:31:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107479#p107479</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107475#p107475</link>
			<description><![CDATA[<p><strong>Malcev</strong>, а для Оперы и остальных браузеров на Blink?<br />Дабы не изобретать заново изобретенное, рекомендую универсальную библиотеку для всех браузеров:<br /><a href="https://translate.google.com/#ru/en/получить%20содержимое%20адресной%20строки%20браузера">https://translate.google.com/#ru/en/пол … и браузера</a>.<br /><a href="http://ru.lmgtfy.com/?q=get+the+contents+of+the+browser&#039;s+address+bar+autohotkey">http://ru.lmgtfy.com/?q=get+the+content … autohotkey</a>.<br />Если хотим из неактивного окна, заменяем &quot;A&quot; в командах на идентификатор окна браузера.</p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Sun, 11 Sep 2016 04:34:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107475#p107475</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107474#p107474</link>
			<description><![CDATA[<div class="codebox"><pre><code>f11::
msgbox % GetBrowserURL_DDE(&quot;MozillaWindowClass&quot;)

GetBrowserURL_DDE(sClass) {
	WinGet, sServer, ProcessName, % &quot;ahk_class &quot; sClass
	StringTrimRight, sServer, sServer, 4
	iCodePage := A_IsUnicode ? 0x04B0 : 0x03EC ; 0x04B0 = CP_WINUNICODE, 0x03EC = CP_WINANSI
	DllCall(&quot;DdeInitialize&quot;, &quot;UPtrP&quot;, idInst, &quot;Uint&quot;, 0, &quot;Uint&quot;, 0, &quot;Uint&quot;, 0)
	hServer := DllCall(&quot;DdeCreateStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;Str&quot;, sServer, &quot;int&quot;, iCodePage)
	hTopic := DllCall(&quot;DdeCreateStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;Str&quot;, &quot;WWW_GetWindowInfo&quot;, &quot;int&quot;, iCodePage)
	hItem := DllCall(&quot;DdeCreateStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;Str&quot;, &quot;0xFFFFFFFF&quot;, &quot;int&quot;, iCodePage)
	hConv := DllCall(&quot;DdeConnect&quot;, &quot;UPtr&quot;, idInst, &quot;UPtr&quot;, hServer, &quot;UPtr&quot;, hTopic, &quot;Uint&quot;, 0)
	hData := DllCall(&quot;DdeClientTransaction&quot;, &quot;Uint&quot;, 0, &quot;Uint&quot;, 0, &quot;UPtr&quot;, hConv, &quot;UPtr&quot;, hItem, &quot;UInt&quot;, 1, &quot;Uint&quot;, 0x20B0, &quot;Uint&quot;, 10000, &quot;UPtrP&quot;, nResult) ; 0x20B0 = XTYP_REQUEST, 10000 = 10s timeout
	sData := DllCall(&quot;DdeAccessData&quot;, &quot;Uint&quot;, hData, &quot;Uint&quot;, 0, &quot;Str&quot;)
	DllCall(&quot;DdeFreeStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;UPtr&quot;, hServer)
	DllCall(&quot;DdeFreeStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;UPtr&quot;, hTopic)
	DllCall(&quot;DdeFreeStringHandle&quot;, &quot;UPtr&quot;, idInst, &quot;UPtr&quot;, hItem)
	DllCall(&quot;DdeUnaccessData&quot;, &quot;UPtr&quot;, hData)
	DllCall(&quot;DdeFreeDataHandle&quot;, &quot;UPtr&quot;, hData)
	DllCall(&quot;DdeDisconnect&quot;, &quot;UPtr&quot;, hConv)
	DllCall(&quot;DdeUninitialize&quot;, &quot;UPtr&quot;, idInst)
	csvWindowInfo := StrGet(&amp;sData, &quot;CP0&quot;)
	StringSplit, sWindowInfo, csvWindowInfo, `&quot; ;&quot;; comment to avoid a syntax highlighting issue in autohotkey.com/boards
	Return sWindowInfo2
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sun, 11 Sep 2016 03:01:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107474#p107474</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Получить ссылку из неактивного окна браузера]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=107473#p107473</link>
			<description><![CDATA[<p>Можно ли получить содержимое адресной строки (ссылку) из свернутого или неактивного окна Мозиллы или Оперы?</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Sat, 10 Sep 2016 22:18:20 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=107473#p107473</guid>
		</item>
	</channel>
</rss>
