<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: UIA как получить доступ к диалогу?]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=18357&amp;type=atom" />
	<updated>2025-01-27T08:26:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=18357</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161929#p161929" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />Спасибо, попробовал диалог открыть по другому, колхоз получился конечно дикий но сработало</p><div class="codebox"><pre><code>	element:= resolve.FindFirstBy(&quot;ClassName=QAction AND Name=Split&quot;)
	loc := element.BoundingRectangle
	CoordMode, Mouse
	Mousemove, loc.l+5, loc.t+5
	Send, {Enter}
	
	Sleep, 100
	Send, {TAB 4}{DOWN 2}{SPACE}</code></pre></div><p>Что интересно, если Send, {enter} заменить на Click то в открывшемся диалоговом окне опять не сработают send tab блаблабла.</p><p>Буду пытаться кадавра этого из табов во что то адекватное превратить</p>]]></content>
			<author>
				<name><![CDATA[meitx]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=44425</uri>
			</author>
			<updated>2025-01-27T08:26:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161929#p161929</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161928#p161928" />
			<content type="html"><![CDATA[<p>Я эту библиотеку не копал, надо смотреть как автор отправляет клики, так как:<br /></p><div class="quotebox"><blockquote><p>Invoke is an asynchronous call and must return immediately without blocking.<br />This behavior is particularly critical for controls that, directly or indirectly, launch a modal dialog when invoked. Any UI Automation client that instigated the event will remain blocked until the modal dialog is closed.</p></blockquote></div><p><a href="https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-implementinginvoke">https://learn.microsoft.com/en-us/windo … tinginvoke</a><br /></p><div class="quotebox"><blockquote><p>Also, while accDoDefaultAction is supposed to return immediately, some implementations block the return. For example, if clicking a link displays a dialog, some implementations will block the return until the dialog is dismissed. Such delays can prevent client applications from processing a dialog box.</p></blockquote></div><p><a href="https://learn.microsoft.com/en-us/windows/win32/api/oleacc/nf-oleacc-iaccessible-accdodefaultaction">https://learn.microsoft.com/en-us/windo … aultaction</a><br />Можно пробовать открывать диалог другим способом, например через controlclick, либо закрывать его из нового потока:<br /><a href="http://forum.script-coding.com/viewtopic.php?pid=129537#p129537">http://forum.script-coding.com/viewtopi … 37#p129537</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2025-01-27T03:18:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161928#p161928</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161927#p161927" />
			<content type="html"><![CDATA[<p>Не представляю, что могло бы вызвать подобный эффект. Диалог не принадлежит скрипту, и не должен на него никак влиять.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2025-01-27T00:38:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161927#p161927</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161926#p161926" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Думаю там даже не с таймерами беда - после того как первый click() проходит и вызывается диалог все команды которые ниже останавливаются пока диалог не закрыт, я пару часов назад туда mousemove вставил, оно по закрытию диалога только выполнилось. Раньше с диалогами вызываемыми из ахк в uia не сталкивался и не особо представляю как с ними взаимодействовать. Запустить treewalker-а? Он тоже встанет пока диалог не закроется.</p>]]></content>
			<author>
				<name><![CDATA[meitx]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=44425</uri>
			</author>
			<updated>2025-01-26T21:11:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161926#p161926</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161925#p161925" />
			<content type="html"><![CDATA[<p>Так может 100 мс не хватает, чтобы окно появилось, нужно WinWait.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2025-01-26T20:21:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161925#p161925</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161921#p161921" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Да он собственно практически весь уже и выложен. Всякую закоментареную дребедень просто убрал.<br /></p><div class="codebox"><pre><code>$#RButton::
{

	MouseClick, right
	UIA := UIA_Interface()
	;UIA.AutoSetFocus := false 
	resolve:= UIA.ElementFromHandle(WinExist(&quot;ahk_exe CLO_Standalone_OnlineAuth_x64.exe&quot;)) 
	element:= resolve.FindFirstBy(&quot;ClassName=QAction AND Name=Split&quot;).Click()
	
	Sleep, 100
	;Send, {TAB 4}{DOWN 2}{SPACE}
	
	element:= resolve.FindFirstBy(&quot;ClassName=QRadioButton AND Name=Uniform Split&quot;,,2).Click()
	;element.GetCurrentPatternAs(&quot;Invoke&quot;).Invoke()
	;element.GetCurrentPatternAs(&quot;Toggle&quot;).ToggleState()
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[meitx]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=44425</uri>
			</author>
			<updated>2025-01-26T18:20:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161921#p161921</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161920#p161920" />
			<content type="html"><![CDATA[<p>Наверно неправильно как-то ищете. Если полный код выложите, будет понятнее.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2025-01-26T17:54:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161920#p161920</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161919#p161919" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong><br />Нужно найти радио с параметрами совпадающими ClassName=QRadioButton AND Name=Uniform Split (и там всякое ещё) и сделать его включить его вместо включеного по умолчанию, проблема в том что я его вроде как ищу но оно не находится.</p>]]></content>
			<author>
				<name><![CDATA[meitx]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=44425</uri>
			</author>
			<updated>2025-01-26T14:00:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161919#p161919</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161918#p161918" />
			<content type="html"><![CDATA[<p>Я бы вообще не парился так, если интерфейс меняется то кто знает что будет после очередной обновы? Если кнопки и поля ввода (или что там нужно?) без изменений - можно через поиск картинки / пикселя всё сделать.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2025-01-26T13:56:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161918#p161918</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161917#p161917" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Делал resolve.FindFirstBy(&quot;ClassName=QRadioButton AND Name=Uniform&quot;,,2) потом и .click() ему посылал и через element:= resolve.FindFirstBy(&quot;QRadioButton AND Name=Uniform&quot;,,2) 	element.GetCurrentPatternAs(&quot;Invoke&quot;).Invoke() достучаться пытался, ноль реакции.</p>]]></content>
			<author>
				<name><![CDATA[meitx]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=44425</uri>
			</author>
			<updated>2025-01-26T13:56:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161917#p161917</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161916#p161916" />
			<content type="html"><![CDATA[<p>Определить данные радиокнопки и послать туда клик, очевидно же, нет?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2025-01-26T13:04:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161916#p161916</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: UIA как получить доступ к диалогу?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=161914#p161914" />
			<content type="html"><![CDATA[<p>Добрый день. У меня есть простенький скрипт который перехватывает пкм при нажатом #<br /></p><div class="codebox"><pre><code>
$#RButton::
	MouseClick, right					; отрабатываем правоклик для вызова контекстного меню
	Sleep, 10	
	Send, {DOWN 7}{ENTER}				;в контекстном меню спускаемся на 7 позиции ниже и нажимаем Enter чтобы вызвать диалоговое окно
	Send, {TAB 4}{DOWN 2}{SPACE}		;в диалоговом окне табом прыгаем до радиокнопки, нажимаем 2 до нужной кнопки и пробелом активируем
Return
</code></pre></div><p>Возможности забиндить кнопки в контекстном меню нет, а разработчик любит добавлять/удалять/менять местами элементы и в каждой версии приходится переделывать скрипт.<br />Решил переделать его &quot;по уму&quot;:<br /></p><div class="codebox"><pre><code>
$#RButton::
{
	MouseClick, right ; посылаю правоклик чтобы открылось контекстное меню
	UIA := UIA_Interface()
	resolve:= UIA.ElementFromHandle(WinExist(&quot;ahk_exe CLO_Standalone_OnlineAuth_x64.exe&quot;)) 
	; проверил что открыта нужная програма и получил UIA
	element:= resolve.FindFirstBy(&quot;ClassName=QAction AND Name=Split&quot;).Click() ;в контекстном меню отлавливаю элемент &quot;Split&quot; и кликаю его, открывается диалоговое окно
</code></pre></div><p>И на этом всё, EdiBox в диалоге активен и реагирует на ручное нажатие Tab, однако &quot;Send, {TAB 4}{DOWN 2}{SPACE}&quot;&nbsp; работало в предыдущем варианте но сейчас не срабатывает. <br />Приаттачиваю скрин диалога и раскрытого UIATreeInspector-а.</p><p>Подскажите, куда копать?</p><p>upd. После &quot;element:= resolve&quot; добавил MouseMove, 100,100,100 - мышь поползла только когда закрыл открытый диалог. Получается что диалог в другом процессе и оно останавливает выполнение скрипта? Или я что то не так понял?</p>]]></content>
			<author>
				<name><![CDATA[meitx]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=44425</uri>
			</author>
			<updated>2025-01-26T10:34:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=161914#p161914</id>
		</entry>
</feed>
