<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: IE_COM_выбор из списка]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16227&amp;type=atom" />
	<updated>2021-04-01T19:44:02Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16227</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: IE_COM_выбор из списка]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147125#p147125" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong></p><p>С Api хотел разобраться позже, пока тёмный лес, хотел сделать временное решение через IE. Логин и пароль это проблемно, вижу, что там и получить его&nbsp; нельзя</p>]]></content>
			<author>
				<name><![CDATA[inseption86]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38818</uri>
			</author>
			<updated>2021-04-01T19:44:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147125#p147125</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: IE_COM_выбор из списка]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147124#p147124" />
			<content type="html"><![CDATA[<p>Да и зачем мучиться через IE, если есть апи.<br /><a href="https://apidata.mos.ru/">https://apidata.mos.ru/</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2021-04-01T19:34:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147124#p147124</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: IE_COM_выбор из списка]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147123#p147123" />
			<content type="html"><![CDATA[<p>Нужен логин и пароль.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2021-04-01T19:32:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147123#p147123</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: IE_COM_выбор из списка]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147122#p147122" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong></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   ; игнор уже запущенного скрипта, переоткрытие

URL := &quot;https://ise.mos.ru/euchet/f?p=185:70:754429688007501&quot;

login := 
pass := 

ComObjError(false)
HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;)
HTTP.Open(&quot;GET&quot;, URL)
HTTP.Send()
if (HTTP.ResponseText = &quot;&quot;)
{
   MsgBox, 262208, , Сайт ИСЭ не доступен!!!
   ExitApp
}
ComObjError(true)


ie := ComObjCreate(&quot;InternetExplorer.Application&quot;)
ie.Visible := true 
ie.Navigate(URL)
while ie.readystate &lt;&gt; 4
	continue
sleep 500
	
	
ie.document.querySelector(&quot;Input[Name=&quot;&quot;p_t01&quot;&quot;]&quot;).value := login
ie.document.querySelector(&quot;Input[Name=&quot;&quot;p_t02&quot;&quot;]&quot;).value := pass
ie.document.querySelector(&quot;button[Id=&quot;&quot;P101_LOGIN&quot;&quot;]&quot;).click()


while ie.document.getElementsByClassName(&quot;metrouicss baron&quot;).length = 0
{
	sleep 300
    continue
}
   
Array1 := [&quot;li&quot;, &quot;li&quot;, &quot;td&quot;, &quot;li&quot;]
Array2 := [&quot;nav nav-tabs clearfix&quot;, &quot;nav nav-pills clearfix&quot;, &quot;borderless-region&quot;, &quot;apexir_ACTIONSMENU&quot; ]
Array3 := [&quot;Отчетность&quot;, &quot;Приборы учета по строениям&quot;, &quot;тип ресурса&quot;, &quot;Выгрузить&quot;]

ArrayCount := 0
for k, v in Array3
{
   ComObjError(false)
   HTMLAnchorElements := ie.document.getElementsByClassName(array2[k])[0].getElementsByTagName(array1[k])
   ComObjError(true)
   
   if (ArrayCount = 0) or if (ArrayCount = 1) 
	{
		loop % HTMLAnchorElements.length 
		{
			if (HTMLAnchorElements[A_index - 1].getElementsByTagName(&quot;a&quot;)[0].innerText = v)
               HTMLAnchorElements[A_index - 1].getElementsByTagName(&quot;a&quot;)[0].click()
        }
	}
	
   if (ArrayCount = 2) 
    {
		loop % HTMLAnchorElements.length 
		{	
			if InStr(HTMLAnchorElements[A_index - 1].innerText, v)
			{
			     MsgBox % HTMLAnchorElements[A_index - 1].innerText
                 MsgBox % ie.document.querySelector(&quot;select[Name=&#039;p_t05&#039;]&quot;).value &quot;_&quot; ie.document.querySelector(&quot;select[Name=&#039;p_t05&#039;]&quot;).selectedIndex

                  ie.document.querySelector(&quot;select[Name=&#039;p_t05&#039;]&quot;).value := 32
                  Event := ie.document.createEvent(&quot;Event&quot;)
                  Event.initEvent(&quot;select&quot;, False, False)
                  ie.document.querySelector(&quot;select[Name=&#039;p_t05&#039;]&quot;).dispatchEvent(Event)   
             }
		}  
	}
	
	if (ArrayCount = 3) 
    {
		
		HTMLAnchorElements := ie.document.getElementById(array2[k]).getElementsByTagName(array1[k])
		 loop % HTMLAnchorElements.length 
		{	
			if (HTMLAnchorElements[A_index - 1].innerText = v)
			{
	           MsgBox % HTMLAnchorElements[A_index - 1].innerText
			   HTMLAnchorElements[A_index - 1].click()
		     }
		 }
	 }
	 
 
	while ie.document.readyState = &quot;loading&quot;
   {
	  sleep 200
      continue
   }
   
  ArrayCount += 1
}



</code></pre></div>]]></content>
			<author>
				<name><![CDATA[inseption86]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38818</uri>
			</author>
			<updated>2021-04-01T19:14:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147122#p147122</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: IE_COM_выбор из списка]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147121#p147121" />
			<content type="html"><![CDATA[<p>Чтобы что-то сказать нужен сам сайт и ваш текущий код работы с ним.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2021-04-01T19:08:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147121#p147121</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: IE_COM_выбор из списка]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147117#p147117" />
			<content type="html"><![CDATA[<p>Добрый вечер, подскажите как можно сделать выбор из списка? В окне хрома и IE в консоли ошибок не возникает, но и ничего не меняется.<br /></p><div class="codebox"><pre><code>
url := &quot;https://ise.mos.ru&quot;

; результат получаю
 MsgBox % ie.document.querySelector(&quot;select[Name=&quot;&quot;p_t05&quot;&quot;]&quot;).value &quot;_&quot; ie.document.querySelector(&quot;select[Name=&quot;&quot;p_t05&quot;&quot;]&quot;).selectedIndex
 
; не работает
ie.document.getElementById(&quot;P681_TYPE&quot;).Focus()
ie.document.getElementById(&quot;P681_TYPE&quot;).value := 31 ; &quot;31&quot;
..
ie.document.getElementById(&quot;P681_TYPE&quot;).value := 31 ; &quot;31&quot;
....
ie.document.getElementById(&quot;P681_TYPE&quot;).selectedIndex := &quot;2&quot; ; 2
..
ie.document.getElementById(&quot;P681_TYPE&quot;).selectedIndex := &quot;2&quot; ; 2
ie.document.getElementById(&quot;P681_TYPE&quot;).onchange()
....
ie.document.querySelector(&quot;select[Name=&quot;&quot;p_t05&quot;&quot;]&quot;).selectedIndex := 4
ie.document.querySelector(&quot;select[Name=&quot;&quot;p_t05&quot;&quot;]&quot;).value := 32
..........
ie.document.querySelector(&quot;select[Name=&#039;p_t05&#039;]&quot;).value := 32
Event := ie.document.createEvent(&quot;Event&quot;)
Event.initEvent(&quot;select&quot;, False, False)
ie.document.querySelector(&quot;select[Name=&#039;p_t05&#039;]&quot;).dispatchEvent(Event)
.......
MouseDownEvent := IE.document.createEvent(&quot;MouseEvent&quot;)
MouseDownEvent.initMouseEvent(&quot;mousedown&quot;,true,false, _, _, _, _, _, _, _, _, _, _, _, _)

MouseUpEvent := IE.document.createEvent(&quot;MouseEvent&quot;)
MouseUpEvent.initMouseEvent(&quot;mouseup&quot;,true,false, _, _, _, _, _, _, _, _, _, _, _, _)

ie.document.querySelector(&quot;select[Name=&quot;&quot;p_t05&quot;&quot;]&quot;).dispatchEvent(MouseDownEvent)
ie.document.querySelector(&quot;select[Name=&quot;&quot;p_t05&quot;&quot;]&quot;).dispatchEvent(MouseUpEvent)

</code></pre></div><br /><div class="codebox"><pre><code>
apex.da.initDaEventList = function(){
apex.da.gEventList = [
{&quot;triggeringElement&quot;:&quot;P681_QUATER&quot;,&quot;triggeringElementType&quot;:&quot;ITEM&quot;,&quot;bindType&quot;:&quot;bind&quot;,&quot;bindEventType&quot;:&quot;change&quot;,actionList:[{&quot;eventResult&quot;:true,&quot;executeOnPageInit&quot;:false,&quot;stopExecutionOnError&quot;:true,javascriptFunction:apex.da.submitPage,&quot;attribute02&quot;:&quot;Y&quot;,&quot;action&quot;:&quot;NATIVE_SUBMIT_PAGE&quot;}]},
{&quot;triggeringElement&quot;:&quot;P681_YEAR&quot;,&quot;triggeringElementType&quot;:&quot;ITEM&quot;,&quot;bindType&quot;:&quot;bind&quot;,&quot;bindEventType&quot;:&quot;change&quot;,actionList:[{&quot;eventResult&quot;:true,&quot;executeOnPageInit&quot;:false,&quot;stopExecutionOnError&quot;:true,javascriptFunction:apex.da.submitPage,&quot;attribute02&quot;:&quot;Y&quot;,&quot;action&quot;:&quot;NATIVE_SUBMIT_PAGE&quot;}]},
{&quot;triggeringElement&quot;:&quot;document&quot;,&quot;triggeringElementType&quot;:&quot;DOM_OBJECT&quot;,&quot;bindType&quot;:&quot;bind&quot;,&quot;bindEventType&quot;:&quot;ready&quot;,actionList:[{&quot;eventResult&quot;:true,&quot;executeOnPageInit&quot;:false,&quot;stopExecutionOnError&quot;:true,javascriptFunction:function (){ var _name;

if ($v(&#039;P681_TYPE&#039;) == &#039;1&#039;) _name = &#039;ЭЭ&#039;
else if ($v(&#039;P681_TYPE&#039;) == &#039;2&#039;) _name = &#039;ТЭ&#039;
else if ($v(&#039;P681_TYPE&#039;) == &#039;31&#039;) _name = &#039;ХВС&#039;
else if ($v(&#039;P681_TYPE&#039;) == &#039;32&#039;) _name = &#039;ГВС&#039;
else if ($v(&#039;P681_TYPE&#039;) == &#039;4&#039;) _name = &#039;Газ&#039;


var _name;
if ($v(&#039;P632_TYPE&#039;) == &#039;1&#039;) _name = &#039;ЭЭ&#039;
else if ($v(&#039;P632_TYPE&#039;) == &#039;2&#039;) _name = &#039;ТЭ&#039;
else if ($v(&#039;P632_TYPE&#039;) == &#039;31&#039;) _name = &#039;ХВС&#039;
else if ($v(&#039;P632_TYPE&#039;) == &#039;32&#039;) _name = &#039;ГВС&#039;
else if ($v(&#039;P632_TYPE&#039;) == &#039;4&#039;) _name = &#039;Газ&#039;

$(&#039;.apexir_WORKSHEET_DATA tbody tr&#039;).first().before(&#039;&lt;tr id=&quot;irColGrpRow1&quot;&gt;&lt;th colspan=&quot;4&quot;&gt;&lt;/th&gt;&lt;th colspan=&quot;23&quot;&gt;&#039; + _name)

},&quot;action&quot;:&quot;NATIVE_JAVASCRIPT_CODE&quot;}]},
{&quot;triggeringElementType&quot;:&quot;BUTTON&quot;,&quot;triggeringButtonId&quot;:&quot;B1703318217089378584&quot;,&quot;bindType&quot;:&quot;live&quot;,&quot;bindEventType&quot;:&quot;click&quot;,actionList:[{&quot;eventResult&quot;:true,&quot;executeOnPageInit&quot;:false,&quot;stopExecutionOnError&quot;:true,javascriptFunction:function (){ if ($v(&#039;apexir_SEARCH&#039;))
  gReport.search(&#039;SEARCH&#039;);},&quot;action&quot;:&quot;NATIVE_JAVASCRIPT_CODE&quot;},{&quot;eventResult&quot;:true,&quot;executeOnPageInit&quot;:false,&quot;stopExecutionOnError&quot;:true,javascriptFunction:apex.da.executePlSqlCode,&quot;ajaxIdentifier&quot;:&quot;57FE04DF9A18FBC16000B821B81A245348A287FE4F51B2A984FD6AFE57CF0D93&quot;,&quot;attribute01&quot;:&quot;P681_DEPARTMENT_TYPE,P681_FILTER_BLD_TYPE,P681_FILTER_RENT&quot;,&quot;attribute04&quot;:&quot;N&quot;,&quot;action&quot;:&quot;NATIVE_EXECUTE_PLSQL_CODE&quot;},{&quot;eventResult&quot;:true,&quot;executeOnPageInit&quot;:false,&quot;stopExecutionOnError&quot;:true,javascriptFunction:apex.da.submitPage,&quot;attribute02&quot;:&quot;Y&quot;,&quot;action&quot;:&quot;NATIVE_SUBMIT_PAGE&quot;}]},
{&quot;triggeringElementType&quot;:&quot;BUTTON&quot;,&quot;triggeringButtonId&quot;:&quot;B1703318401312378586&quot;,&quot;bindType&quot;:&quot;live&quot;,&quot;bindEventType&quot;:&quot;click&quot;,actionList:[{&quot;eventResult&quot;:true,&quot;executeOnPageInit&quot;:false,&quot;stopExecutionOnError&quot;:true,javascriptFunction:apex.da.executePlSqlCode,&quot;ajaxIdentifier&quot;:&quot;5097AF6DA49B5BCF56D28E3C92BE055FA62AF4F2F2CF3863DACDE24605744F9F&quot;,&quot;attribute01&quot;:&quot;P681_DATE_FROM,P681_DATE_TILL,P681_DEPARTMENT_TYPE,P681_FILTER_BLD_TYPE,P681_FILTER_RENT&quot;,&quot;attribute04&quot;:&quot;N&quot;,&quot;action&quot;:&quot;NATIVE_EXECUTE_PLSQL_CODE&quot;},{&quot;eventResult&quot;:true,&quot;executeOnPageInit&quot;:false,&quot;stopExecutionOnError&quot;:true,javascriptFunction:apex.da.submitPage,&quot;attribute02&quot;:&quot;Y&quot;,&quot;action&quot;:&quot;NATIVE_SUBMIT_PAGE&quot;}]},
{&quot;triggeringElementType&quot;:&quot;REGION&quot;,&quot;triggeringRegionId&quot;:&quot;R1703319202272378594&quot;,&quot;triggeringButtonId&quot;:&quot;B1703318401312378586&quot;,&quot;bindType&quot;:&quot;bind&quot;,&quot;bindEventType&quot;:&quot;change&quot;,actionList:[{&quot;eventResult&quot;:true,&quot;executeOnPageInit&quot;:false,&quot;stopExecutionOnError&quot;:true,javascriptFunction:function (){ var _name;

if ($v(&#039;P681_TYPE&#039;) == &#039;1&#039;) _name = &#039;ЭЭ&#039;
else if ($v(&#039;P681_TYPE&#039;) == &#039;2&#039;) _name = &#039;ТЭ&#039;
else if ($v(&#039;P681_TYPE&#039;) == &#039;31&#039;) _name = &#039;ХВС&#039;
else if ($v(&#039;P681_TYPE&#039;) == &#039;32&#039;) _name = &#039;ГВС&#039;
else if ($v(&#039;P681_TYPE&#039;) == &#039;4&#039;) _name = &#039;Газ&#039;
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[inseption86]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38818</uri>
			</author>
			<updated>2021-04-01T17:59:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147117#p147117</id>
		</entry>
</feed>
