<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Закрыть рабочую папку скрипта]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9233&amp;type=atom" />
	<updated>2014-05-27T03:00:38Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9233</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83361#p83361" />
			<content type="html"><![CDATA[<p>Заметил такой баг, так как не показывал этот файл:<br /></p><div class="codebox"><pre><code>MsgBox % FileExist(&quot;C:\Windows\System32\SnippingTool.exe&quot;)</code></pre></div><p>У меня FileExist не видит этот файл. Хотя с taskmgr.exe из этой папки всё Ок.<br />Убрав FileExist (из своего кода) также не работало, пока не заменил:<br /></p><div class="codebox"><pre><code>Run, explorer /select`, &quot;%FilePath%&quot;</code></pre></div><p>на:<br /></p><div class="codebox"><pre><code>Run, %A_WinDir%\explorer.exe /select`, &quot;%FilePath%&quot; </code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-27T03:00:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83361#p83361</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81858#p81858" />
			<content type="html"><![CDATA[<p>Если в папке, где содержится целевой объект, находится большое количество других объектов (например, это C:\Windows\System32), тогда с указанием <em>SetBatchLines, -1</em> чувствуется разница в скорости:<br /></p><div class="codebox"><pre><code>SelectFilePath(A_WinDir . &quot;\System32\taskmgr.exe&quot;)

SelectFilePath(FilePath)
{
   SetBatchLines, -1
   SplitPath, FilePath,, Dir
   for window in ComObjCreate(&quot;Shell.Application&quot;).Windows
   {
      ShellFolderView := window.Document
      
      try if ((Folder := ShellFolderView.Folder).Self.Path != Dir)
         continue
      catch
         continue
      
      for item in Folder.Items
      {
         if (item.Path != FilePath)
            continue
         
         WinActivate, % &quot;ahk_id&quot; window.hwnd
         ShellFolderView.SelectItem(item, 1|4|8|16)
         Return
      }
   }
   Run, explorer /select`, &quot;%FilePath%&quot;
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-04-16T23:05:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81858#p81858</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81837#p81837" />
			<content type="html"><![CDATA[<p>Хотя да, отсеивать лишние окна не помешает, просто посмотрел невнимательно. Но тогда уж, чтобы не получать одни и те же объекты несколько раз, так:<br /></p><div class="codebox"><pre><code>SelectFilePath(FilePath)
{
   SplitPath, FilePath,, Dir
   for window in ComObjCreate(&quot;Shell.Application&quot;).Windows
   {
      ShellFolderView := window.Document
      
      try if ((Folder := ShellFolderView.Folder).Self.Path != Dir)
         continue
      catch
         continue
      
      for item in Folder.Items
      {
         if (item.Path != FilePath)
            continue
         
         ShellFolderView.SelectItem(item, 1|4|8|16)
         WinActivate, % &quot;ahk_id&quot; window.hwnd
         Return
      }
   }
   Run, explorer /select`, &quot;%FilePath%&quot;
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-04-16T14:08:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81837#p81837</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81834#p81834" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Ни с того ни с сего, начало ругатся что &quot;Folder&quot; неизвестное имя...</p></blockquote></div><p>Да, это я упустил, что у окна IE (которое тоже относится к Shell) нет такого свойства. Так проще:<br /></p><div class="codebox"><pre><code>SelectFilePath(FilePath)
{
   for item in ComObjCreate(&quot;Shell.Application&quot;).Windows
   {
      window := item, ShellFolderView := item.Document
      try for item in ShellFolderView.Folder.Items
      {
         if (item.path = FilePath)
         {
            ShellFolderView.SelectItem(item, 1|4|16)   ; 1 — select the item, 4 — deselect all but the specified item, 16 — give the item the focus.
            WinActivate, % &quot;ahk_id&quot; hwnd := window.hwnd
            break 2
         }
      }
   }
   if !hwnd
      Run, explorer /select`, &quot;%FilePath%&quot;
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-04-16T13:25:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81834#p81834</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81833#p81833" />
			<content type="html"><![CDATA[<p>Ни с того ни с сего, начало ругатся что &quot;Folder&quot; неизвестное имя... С чего бы. Хотя и выдавая ошибку всё равно дальше работает.</p><p>По случаю переделал код, чтобы не перебирать все файлы во всех окнах.<br /></p><div class="codebox"><pre><code>
OpenDir(FilePath)    {
    SplitPath, FilePath,, FolderPath  
    for window in ComObjCreate(&quot;Shell.Application&quot;).Windows
    {
        try if (window.Document.Folder.Self.Path = FolderPath)
        { 
            try for item in window.Document.Folder.Items
            {  
                if (item.path = FilePath)
                {
                    WinActivate, % &quot;ahk_id&quot; window.hwnd
                    window.Document.SelectItem(item, 1|4|16|8)   
                    Return 
                }
            } 
        } 
    }
    Run, explorer /select`, &quot;%FilePath%&quot;
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-16T12:37:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81833#p81833</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81695#p81695" />
			<content type="html"><![CDATA[<p>А, нашёл, нужна восьмёрка:<br /></p><div class="codebox"><pre><code>SelectItem(item, 1|4|16|8)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-12T19:35:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81695#p81695</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81694#p81694" />
			<content type="html"><![CDATA[<p>Ещё вопрос. При запуске файл выделяется. Но, если список длинный, и был выделен последний файл, а наш файл первый, то как сделать так чтобы выделенный файл было видно?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-12T19:32:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81694#p81694</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81690#p81690" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Прерывание и своего, и следующего по иерархии цикла (по умолчанию 1).</p></blockquote></div><p>Понял.</p><p>Работает SetTitleMatchMode RegEx, просто был неверный шаблон:<br /></p><div class="codebox"><pre><code>
SetTitleMatchMode RegEx

run D:\MyFolder
run D:\MyFolder\MyFolder
Sleep 1100
  
Dir = D:\MyFolder
While WinExist(&quot;ahk_exe explorer.exe ahk_class CabinetWClass&quot;, &quot;im`a)^.*?: \Q&quot; Dir &quot;\E$&quot;)
    WinClose
Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-12T17:21:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81690#p81690</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81686#p81686" />
			<content type="html"><![CDATA[<p>Прерывание и своего, и следующего по иерархии цикла <a href="http://ahkscript.org/docs/commands/Break.htm">(по умолчанию 1)</a>.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-04-12T12:58:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81686#p81686</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81682#p81682" />
			<content type="html"><![CDATA[<p>Кстати, а что тут означает <strong>2</strong>:<br /></p><div class="codebox"><pre><code>break 2</code></pre></div><p>или просто опечатка?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-12T09:50:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81682#p81682</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81680#p81680" />
			<content type="html"><![CDATA[<p>Так это сразу было очевидно, диалог был интересен только с познавательной стороны. И имхо оправдался познанием заморочек с SetTitleMatchMode RegEx.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-12T09:21:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81680#p81680</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81679#p81679" />
			<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>2014-04-12T09:17:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81679#p81679</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81677#p81677" />
			<content type="html"><![CDATA[<p>Значит работают некие непонятно\неполноценные шаблоны <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-12T09:07:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81677#p81677</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81673#p81673" />
			<content type="html"><![CDATA[<p>Вот так сработало:<br /></p><div class="codebox"><pre><code>SetTitleMatchMode RegEx

run D:\MyFolder
run D:\MyFolder\MyFolder
Sleep 2000
  
Dir := &quot;D:\MyFolder&quot;
if WinExist(&quot;ahk_class CabinetWClass&quot;, &quot;\Q&quot; Dir &quot;\E$&quot;)
   WinClose
</code></pre></div><p><img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-04-12T08:36:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81673#p81673</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Закрыть рабочую папку скрипта]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81671#p81671" />
			<content type="html"><![CDATA[<p>В справке написано<br /></p><div class="quotebox"><blockquote><p>RegEx (v1.0.45+): Changes WinTitle, WinText, ExcludeTitle, and ExcludeText to be regular expressions.</p></blockquote></div><p>Но не срабатывает почему-то.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-04-12T08:23:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81671#p81671</id>
		</entry>
</feed>
