<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Включение/выключение javascript в ie]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10689&amp;type=atom" />
	<updated>2015-06-14T00:36:22Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10689</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Включение/выключение javascript в ie]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94485#p94485" />
			<content type="html"><![CDATA[<p>Пока только придумал, проверять включенную джаву через яндекс: <br /></p><div class="codebox"><pre><code>CloseProcess(&quot;iexplore.exe&quot;)
loop 20
{
   if A_Index = 1
      enableJava()
   if A_Index = 2
   {
      disableJava()
      disableJava := 1
   }
   loop
   {
      com++
      oIE := ComObjCreate(&quot;InternetExplorer.Application&quot;)
      oIE.navigate(&quot;http://yandex.ru/internet&quot;)
      While oIE.readyState != 4 || oIE.document.readyState != &quot;complete&quot; || oIE.busy
         Sleep, 10
      if disableJava != 1
         break
      ResponseText := oIE.document.documentElement.OuterHtml
      If Instr(ResponseText, &quot;&lt;strong&gt;JavaScript&lt;/strong&gt;: да&quot;)
      {
         oIE.visible := True, oIEHWND := oIE.HWND
         WinMaximize ahk_id %oIEHWND%
         msgbox, экземпляр IE %com% почему-то использует джаву
         Continue
      }
      msgbox, с экземпляром IE %com% все в порядке
      break
   }
}

CloseProcess(MyProc)
{
   ErrorLevel := 1
   While ErrorLevel and A_Index &lt; 10
   {
      Process, Close, %MyProc%
      Process, WaitClose, %MyProc%, 1
   }
   return
}

enableJava()
{
   regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3,1400, 0
   dllcall(&quot;wininet\InternetSetOptionW&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;39&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;0&quot;)
   return
}

disableJava()
{
   regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3,1400, 3
   dllcall(&quot;wininet\InternetSetOptionW&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;39&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;0&quot;)
   return
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-06-14T00:36:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94485#p94485</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Включение/выключение javascript в ie]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94481#p94481" />
			<content type="html"><![CDATA[<p>Хорошо, но если изменить эту настройку в самом броузере, то рестарт приложения не нужен.<br />Но ладно.<br />Вот написал скрипт и хоть убей не могу логичесуи объяснить почему при второй и шестой итерации этот джаваскрит становится вновь запущенным???<br />Если откоментить 2 строчки с закрытием IE окна либо откоментить<br /></p><div class="codebox"><pre><code>   ;If (A_Index = 2) or (A_Index = 6)
   ;   Continue</code></pre></div><p>то все становится в порядке.<br />Но мне надо чтобы все окна запускались с отключенным джаваскриптом.<br /></p><div class="codebox"><pre><code>CloseProcess(&quot;iexplore.exe&quot;)
ComObjError(false)
regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3,1400, 0
dllcall(&quot;wininet\InternetSetOptionW&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;39&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;0&quot;)
oIE := ComObjCreate(&quot;InternetExplorer.Application&quot;)
oIE.visible := True, oIEHWND := oIE.HWND
WinMaximize ahk_id %oIEHWND%
oIE.navigate(&quot;https://www.whatismybrowser.com/is-javascript-enabled&quot;)
While oIE.readyState != 4 || oIE.document.readyState != &quot;complete&quot; || oIE.busy
   Sleep, 10
If Instr(oIE.document.documentElement.OuterHtml, &quot;&lt;span&gt;No&lt;/span&gt;&quot;)
   msgbox % Error

regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3,1400, 3
dllcall(&quot;wininet\InternetSetOptionW&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;39&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;0&quot;)
loop 10
{
   oIE := ComObjCreate(&quot;InternetExplorer.Application&quot;)
   ;If (A_Index = 2) or (A_Index = 6)
   ;   Continue
   oIE.visible := True, oIEHWND := oIE.HWND
   WinMaximize ahk_id %oIEHWND%
   oIE.navigate(&quot;https://www.whatismybrowser.com/is-javascript-enabled&quot;)
   While oIE.readyState != 4 || oIE.document.readyState != &quot;complete&quot; || oIE.busy
      Sleep, 10
   If Instr(oIE.document.documentElement.OuterHtml, &quot;&lt;span&gt;Yes&lt;/span&gt;&quot;)
      msgbox % &quot;Ошибка на &quot; A_Index &quot; итерации &quot;
   ;WinClose ahk_id %oIEHWND%
   ;WinWaitClose ahk_id %oIEHWND%
}

CloseProcess(MyProc)
{
   ErrorLevel := 1
   While ErrorLevel and A_Index &lt; 10
   {
      Process, Close, %MyProc%
      Process, WaitClose, %MyProc%, 1
   }
   return
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-06-13T18:11:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94481#p94481</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Включение/выключение javascript в ie]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94473#p94473" />
			<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>2015-06-13T15:28:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94473#p94473</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Включение/выключение javascript в ie]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94471#p94471" />
			<content type="html"><![CDATA[<p>Да. Уверен. Я этот ключ сам искал в<br /><a href="https://support.microsoft.com/en-us/kb/182569">https://support.microsoft.com/en-us/kb/182569</a><br />И он действительно изменяет значение в Internet Security settings -&gt; enable/disable scripting.<br />Но запущенная версия IE не подхватывает эти изменения.<br />Для этого вызываем wininet.dll<br /><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa385328%28v=vs.85%29.aspx">https://msdn.microsoft.com/en-us/librar … 85%29.aspx</a><br /></p><div class="codebox"><pre><code>INTERNET_OPTION_SETTINGS_CHANGED
    39
    Notifies the system that the registry settings have been changed so that it verifies the settings on the next call to InternetConnect. This is used by InternetSetOption.</code></pre></div><p>Но почему-то эта фишка не срабатывает с запущенными приложениями Ie.<br />Для изменения прокси на лету после 39, нужно еще вызывать 37<br /></p><div class="quotebox"><blockquote><p>INTERNET_OPTION_REFRESH<br />&nbsp; &nbsp; 37<br />&nbsp; &nbsp; Causes the proxy data to be reread from the registry for a handle. No buffer is required. This option can be used on the HINTERNET handle returned by InternetOpen. It is used by InternetSetOption.</p></blockquote></div><p>Но эта опция касается только прокси как я понял.<br />Вот и вопрос - какую опцию вызвать, чтобы оповестить запущенный IE об отключении джаваскрипта.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-06-13T13:11:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94471#p94471</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Включение/выключение javascript в ie]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94464#p94464" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Скопипастил откуда-то.</p></blockquote></div><p>А ты уверен, что нужный ключ в реестре меняешь? Это зависит от версии IE.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-06-12T23:16:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94464#p94464</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Включение/выключение javascript в ie]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94463#p94463" />
			<content type="html"><![CDATA[<p>Скопипастил откуда-то. Кавычки не нужны?<br />Убрал кавычки - результат тот же.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-06-12T22:51:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94463#p94463</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Включение/выключение javascript в ie]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94459#p94459" />
			<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>2015-06-12T17:09:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94459#p94459</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Включение/выключение javascript в ie]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94457#p94457" />
			<content type="html"><![CDATA[<p>Написал такой код, однако он не работает в запущенном IE.<br />Что пропустил?<br /></p><div class="codebox"><pre><code>f11::
regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3,1400, 0
dllcall(&quot;wininet\InternetSetOptionW&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;39&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;0&quot;)
return

f12::
regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3,1400, 3
dllcall(&quot;wininet\InternetSetOptionW&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;39&quot;,&quot;int&quot;,&quot;0&quot;,&quot;int&quot;,&quot;0&quot;)
return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-06-12T15:10:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94457#p94457</id>
		</entry>
</feed>
