<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: Нажать ссылку в браузере]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10341&amp;type=atom" />
	<updated>2015-01-26T02:38:35Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10341</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90964#p90964" />
			<content type="html"><![CDATA[<p>Для этого нужно узнать его PID, тут без WMI не обойдётся.<br />Предлагаю переводить фокус в область уведомлений (со своим путём к nircmd, разумеется):<br /></p><div class="codebox"><pre><code>CreateObject(&quot;WScript.Shell&quot;).Run &quot;&quot;&quot;C:\Моя папка\nircmd\nircmd.exe&quot;&quot; sendkeypress lwin+b&quot;</code></pre></div><p>Либо вызывать и убирать меню &quot;Пуск&quot;<br /></p><div class="codebox"><pre><code>CreateObject(&quot;WScript.Shell&quot;).SendKeys(&quot;^{ESC}{ESC}&quot;)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-01-26T02:38:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90964#p90964</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90955#p90955" />
			<content type="html"><![CDATA[<p>Спасибо за столь подробный ответ.<br />Если в адресную строку перевести курсор - всё равно не срабатывает переход по ссылке.<br />А как сделать, к примеру AppActivate(&quot;Explorer&quot;)? Пробовал это название - не сработало. Быть может есть какой нибудь стандартный процесс, на который можно перевести фокусировку?</p>]]></content>
			<author>
				<name><![CDATA[cyber54245]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32811</uri>
			</author>
			<updated>2015-01-25T15:31:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90955#p90955</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90949#p90949" />
			<content type="html"><![CDATA[<p><strong>cyber54245</strong><br />Стандартными средствами никак. Либо, как выше предлагалось, вызывать WSH.PopUp &quot;&quot;, 0.6, &quot;&quot;.</p><p>Но сразу хочу отметить, что это исключительно частное решение в стационарных условиях, и у меня, к примеру, проблема лежала исключительно в плоскости доступа ресурса на 2-й попытке перейти по ссылке. Т.е. никакая дефокусировка окна, с которой я практически начинал тесты, к положительному результату не приводила.<br />Тоже много чего пробовал отключать, настраивать опции - бесполезно. Только откат помог.</p><p>А какое поведение будет в случае ухода с рабочего поля, допустим, на адресную строку?</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-01-25T10:45:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90949#p90949</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90947#p90947" />
			<content type="html"><![CDATA[<p>Кто нибудь подскажет как сделать действие обратное app.activate?</p>]]></content>
			<author>
				<name><![CDATA[cyber54245]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32811</uri>
			</author>
			<updated>2015-01-25T10:23:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90947#p90947</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90907#p90907" />
			<content type="html"><![CDATA[<p>А я просто откатился до 7-й джавы, и у меня мои исходники опять заработали. <span class="postimg"><img src="http://smiles.kolobok.us/mini/pardon_mini.gif" alt="http://smiles.kolobok.us/mini/pardon_mini.gif" /></span><br />Вывод, 6.1.7600.16385 - зло. В сборке идут 3 сетевых модуля, они, видимо, и гадят.<br />Возможно, и при установке последнего IE та же схема.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-01-23T13:05:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90907#p90907</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90900#p90900" />
			<content type="html"><![CDATA[<p>ХАХА!!! Вы не поверите!!! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>Решил проблему! Если можно так выразиться)</p><p>Запускаю этот же скрипт из предыдущего моего сообщения. И просто открываю другое окно любого приложения. Так сказать, убираю фокус с окна IE. И что вы думаете? Скрипт спокойно себе исполняется без каких либо ошибок <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> </p><p>А что же тогда сделать, чтобы автоматически расфокусировать окно?</p>]]></content>
			<author>
				<name><![CDATA[cyber54245]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32811</uri>
			</author>
			<updated>2015-01-23T10:17:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90900#p90900</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90898#p90898" />
			<content type="html"><![CDATA[<p>Заметил, что с <em>msgbox &quot;&quot;, , &quot;&quot;</em> отлично работает и этот вариант скрипта:<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="codebox"><pre><code>Dim strUrl, oIE, oTag
strUrl = &quot;http://forum.script-coding.com/&quot;
Set oIE = CreateObject(&quot;InternetExplorer.Application&quot;)

oIE.Visible = True
oIE.Navigate strUrl
WScript.Sleep 3000

For Each oTag in oIE.Document.GetElementsByTagName(&quot;a&quot;)
    If InStr(1, oTag.href, &quot;viewforum.php?id=25&quot;) &gt; 0 Then
        msgbox &quot;&quot;, , &quot;&quot;
        oTag.Click 
        Exit For
    End If
Next
WScript.Sleep 5000

For Each oTag in oIE.Document.GetElementsByTagName(&quot;a&quot;)
    If InStr(1, oTag.href, &quot;viewtopic.php?id=7&quot;) &gt; 0 Then
        msgbox &quot;&quot;, , &quot;&quot;
        oTag.Click 
        Exit For
    End If
Next
WScript.Sleep 5000

For Each oTag in oIE.Document.GetElementsByTagName(&quot;a&quot;)
    If InStr(1, oTag.href, &quot;profile.php?id=2&quot;) &gt; 0 Then
        msgbox &quot;&quot;, , &quot;&quot;
        oTag.Click 
        Exit For
    End If
Next
WScript.Sleep 5000

For Each oTag in oIE.Document.GetElementsByTagName(&quot;a&quot;)
    If InStr(1, oTag.href, &quot;misc.php?action=rules&quot;) &gt; 0 Then
        msgbox &quot;&quot;, , &quot;&quot;
        oTag.Click 
        Exit For
    End If
Next</code></pre></div></div></div><p>А такой вид мне подходит на много больше. Чтобы между поиском ссылок я мог задействовать другие функции и лепить всё как будет нужно <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Но опять же, без <em>msgbox</em> не работает. Как же его блин заставить работать))</p>]]></content>
			<author>
				<name><![CDATA[cyber54245]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32811</uri>
			</author>
			<updated>2015-01-23T10:08:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90898#p90898</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90884#p90884" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>cyber54245 пишет:</cite><blockquote><p>Вы не знаете как сымитировать msgbox уже в таком случае?...</p></blockquote></div><p>Единственное, что приходит на ум - заменить msgbox на <a href="http://script-coding.com/WSH/WshShell.html#3.2.">.popup</a> с секундной выдержкой, чтобы не нужно было каждый раз вручную жать. Однако замечу, что это чудовищный костыль. <br />Есть ощущение, что вызываются какие-то скрипты на странице, по событию перехода фокуса (стоит проверить event listeners на странице). Может быть стоит его (фокус) вручную снять с окна IE и вновь вернуть?<br />Так же можно пойти немного другим путем: добавить в DOM страницы скрипт, который сам находил бы нужную ссылку на странице и вызывал метод .click, не снаружи IE, а &quot;изнутри&quot;. Вероятно, при таком обращении подобные ошибки удастся избежать. Но нужно определить условия, при которых данный скрипт должен активироваться.</p>]]></content>
			<author>
				<name><![CDATA[omegastripes]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=29228</uri>
			</author>
			<updated>2015-01-22T20:46:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90884#p90884</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90878#p90878" />
			<content type="html"><![CDATA[<p>Вы не знаете как сымитировать msgbox уже в таком случае? <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> <br />Или вообще как-то упростить код до примитивности %)</p>]]></content>
			<author>
				<name><![CDATA[cyber54245]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32811</uri>
			</author>
			<updated>2015-01-22T17:58:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90878#p90878</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90861#p90861" />
			<content type="html"><![CDATA[<p>У меня код из <a href="http://forum.script-coding.com/viewtopic.php?pid=90854#p90854">http://forum.script-coding.com/viewtopi … 854#p90854</a> отрабатывает без ошибок. Джаву пока не обновлял <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" />. Но подобное поведение IE (с аналогичными ошибками) встречал и ранее.</p>]]></content>
			<author>
				<name><![CDATA[omegastripes]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=29228</uri>
			</author>
			<updated>2015-01-21T22:58:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90861#p90861</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90860#p90860" />
			<content type="html"><![CDATA[<p>Вы, наверное, будете удивлены, но после того, как я вчера обновил джаву, у меня те же свистопляски начались. <span class="postimg"><img src="http://smiles.kolobok.us/user/Cherna_20.gif" alt="http://smiles.kolobok.us/user/Cherna_20.gif" /></span></p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-01-21T22:29:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90860#p90860</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90854#p90854" />
			<content type="html"><![CDATA[<p>Да, даже при On Error Resume Next возникает ошибка: Требуемый ресурс занят.<br />Делает один переход по ссылке, и потом ошибка. На некоторых сайтах успевает два раза перейти.<br />Вот код:<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="codebox"><pre><code>URI = &quot;http://forum.script-coding.com/&quot;  &#039; исходный адрес
Sec = 1  &#039; максимальное число секунд на проверку загрузки страницы
&#039; массив с искомыми подстроками и секундами на ожидание после пробела:
Arr = Array(&quot;viewtopic 3&quot;, &quot;register.php 2&quot;, &quot;rules.html 2&quot;)


Set IE = CreateObject(&quot;InternetExplorer.Application&quot;)
Dim M(0) : M(0) = 0 : IE.Visible = True : OpenURL URI


Sub OpenURL(URL)
  With IE
    .Navigate(URL) : T = Timer
    Do : WScript.Sleep 50 : If Timer - T &gt; Sec Then Exit Do
    Loop Until Not .Busy And .ReadyState = 4
    For Each Link In .Document.Links
      If InStr(Link, Split(Arr(M(0)))(0)) And Split(Link, &quot;#&quot;)(0) &lt;&gt; Split(URL, &quot;#&quot;)(0) Then
      If InStrRev(Link, &quot;/index.php&quot;) = 0 And (InStr(Link, &quot;://&quot;) Or Left(Link, 4) = &quot;www.&quot;) Then
        WScript.Sleep Split(Arr(M(0)))(1) * 1000
        On Error Resume Next
Do
    WScript.Sleep 500
    Err.Clear
    Link.Click
Loop Until Err.Number = 0
On Error Goto 0 
If M(0) = UBound(Arr) Then Exit Sub
        M(0) = M(0) + 1 : URL = Link : Test = 1 : Exit For
      End If
      End If
    Next
  End With : If Test Then OpenURL URL
End Sub</code></pre></div></div></div>]]></content>
			<author>
				<name><![CDATA[cyber54245]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32811</uri>
			</author>
			<updated>2015-01-21T18:25:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90854#p90854</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90853#p90853" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>cyber54245 пишет:</cite><blockquote><p>... вставил Ваш код. И снова та же ошибка: Требуемый ресурс занят. ...</p></blockquote></div><p>То есть, выходит, ошибка возникает в режиме On Error Resume Next? =8-0</p>]]></content>
			<author>
				<name><![CDATA[omegastripes]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=29228</uri>
			</author>
			<updated>2015-01-21T14:16:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90853#p90853</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90852#p90852" />
			<content type="html"><![CDATA[<p>Та же ошибка. Просто вместо <em>Link.Click</em> в скрипте как выше вставил Ваш код. И снова та же ошибка: Требуемый ресурс занят. Странно почему при MsgBox всё работает и никаких ошибок не появляется. Быть может как-то сымитировать этот msgbox можно да и хрен с ним?))</p>]]></content>
			<author>
				<name><![CDATA[cyber54245]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32811</uri>
			</author>
			<updated>2015-01-21T14:03:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90852#p90852</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Нажать ссылку в браузере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=90851#p90851" />
			<content type="html"><![CDATA[<p><strong>cyber54245</strong>, предлагаю попробовать заменить</p><div class="codebox"><pre><code>Link.Click</code></pre></div><p>кодом с местной анастезией:</p><div class="codebox"><pre><code>On Error Resume Next
Do
    WScript.Sleep 500
    Err.Clear
    Link.Click
Loop Until Err.Number = 0
On Error Goto 0</code></pre></div>]]></content>
			<author>
				<name><![CDATA[omegastripes]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=29228</uri>
			</author>
			<updated>2015-01-21T13:36:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=90851#p90851</id>
		</entry>
</feed>
