<?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="http://forum.script-coding.com/extern.php?action=feed&amp;tid=9653&amp;type=atom" />
	<updated>2014-05-29T10:14:22Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=9653</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83479#p83479" />
			<content type="html"><![CDATA[<p>Точно! А Я и не заметил.<br /></p><div class="codebox"><pre><code>WinGet, OutputVar, ID, ahk_pid %PID% ahk_class AutoHotkey</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-29T10:14:22Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83479#p83479</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83478#p83478" />
			<content type="html"><![CDATA[<p>У основного окна класс AutoHotkey. У GUI-окна класс AutoHotkeyGUI.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-05-29T10:01:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83478#p83478</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83477#p83477" />
			<content type="html"><![CDATA[<p>В смысле отталкиваюсь. Просто интересно по каким признакам можно определить именно главное окно скрипта.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-29T09:38:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83477#p83477</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83476#p83476" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Мне например хочется показать только главное окно скрипта, как это сделать.</p></blockquote></div><p>В каком смысле?&nbsp; От чего Вы отталкиваетесь?</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-05-29T09:36:05Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83476#p83476</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83474#p83474" />
			<content type="html"><![CDATA[<p>Мне например хочется показать только главное окно скрипта, как это сделать.</p><div class="codebox"><pre><code>DetectHiddenWindows, On
Gui, +Toolwindow
Gui, Show, w111 h111 NA
1::
    MouseGetPos, , , winid 
    WinGet, PID, PID, ahk_id %winid% 
    WinGet, OutputVar, List, ahk_pid %PID%
 
    List =
    Loop % OutputVar
        List .= OutputVar%A_Index% &quot;`n&quot;
    ToolTip % List &quot;`n&quot; A_ScriptHwnd 

    ; Хочу показать только главное
    ; WinShow  % &quot;ahk_id&quot; OutputVar%ScriptHwnd%
    Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-29T09:20:35Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83474#p83474</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83473#p83473" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Не могу придумать, как определить хэндл основного окна зная пид скрипта.</p></blockquote></div><p>Наверное так:<br /></p><div class="codebox"><pre><code>WinGet, OutputVar, ID, ahk_pid %ПеременнаяСодержащаяPID%</code></pre></div><br /><div class="quotebox"><blockquote><p>Искать их по классу скрытого окна.</p></blockquote></div><p>Я имел в виду<br /></p><div class="codebox"><pre><code>
DetectHiddenWindows, On
WinGet, OutputVar, list, ahk_class AutoHotkey
MsgBox, %OutputVar% `r`n %OutputVar1% `r`n %OutputVar2% `r`n %OutputVar3%
Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-05-29T09:11:28Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83473#p83473</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83467#p83467" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Искать их по классу скрытого окна.</p></blockquote></div><p>Не могу придумать, как определить хэндл основного окна зная пид скрипта.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-29T08:00:54Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83467#p83467</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83429#p83429" />
			<content type="html"><![CDATA[<p>Не хватает динамического отслеживания памяти, занимаемой процессом, и загрузки процессора.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-05-28T12:21:40Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83429#p83429</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83427#p83427" />
			<content type="html"><![CDATA[<p><a href="http://forum.script-coding.com/viewtopic.php?id=8724">Тут поинтересней</a> есть.<br />Можно и скомпилированные, но у меня их и небыло никогда. <br />Сделал просто для личных нужд, как подпрограмму в &quot;основной&quot; скрипт. Ну и как пример поиска запущенных скриптов для ТС.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-28T12:05:58Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83427#p83427</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83425#p83425" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ypppu пишет:</cite><blockquote><p>Думаю, может скомпилированные скрипты добавить к отображаемым?</p></blockquote></div><p>Да, скомпилированные добавить не помешает. Можно чекбокс сделать &quot;Показывать скомпилированные скрипты&quot;.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-05-28T12:03:40Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83425#p83425</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83423#p83423" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Ну и по случаю, давно хотел себе сделать простенький таскман анк скриптов.</p></blockquote></div><p>Запустил. Сразу заругался, что в Shell32.dll нет иконки 262.</p><p>Исправил 262 на 26. Запустил. Скрипт сказал, что запущенных скриптов нет, хотя работало два скомпилированных скрипта (один AHK-clssic, второй AHK_L). Думаю, может скомпилированные скрипты добавить к отображаемым? Искать их по классу скрытого окна. Это так, мысли вслух.</p><p>Запустил, предварительно запустив нескомпилированный скрипт - всё нормально отобразил.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-05-28T11:52:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83423#p83423</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83421#p83421" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Ну и по случаю, давно хотел себе сделать простенький таскман анк скриптов.</p></blockquote></div><p>Интересно, тоже напишу себе что-то такое.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-05-28T11:36:27Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83421#p83421</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83407#p83407" />
			<content type="html"><![CDATA[<p>Если реагирует на хоткей, то считай что и не завис.<br />Насчёт обработки ошибок определённых строк, есть TRY. Для всех ошибок Com объектов в скрипте, есть ComObjError(false). <br /></p><div class="quotebox"><cite>Next пишет:</cite><blockquote><p> Если скрипт не скомпилирован, то его процесс&nbsp; трудно найти в диспетчере, если параллельно ещё 2-3 скрипта работает.</p></blockquote></div><p>Ну и по случаю, давно хотел себе сделать простенький таскман анк скриптов.<br /></p><div class="codebox"><pre><code>

  ; http://forum.script-coding.com/viewtopic.php?pid=83407#p83407

#SingleInstance Force
#NoTrayIcon
#NoEnv
ListLines Off
SetBatchLines -1
Menu, Tray, UseErrorLevel
Menu, Tray, Icon, Shell32.dll, 262

IgnoreList =  
LimitRow := 12, Process := [], Count := 0
Query := &quot;SELECT * FROM Win32_Process WHERE Caption = &#039;AutoHotkey.exe&#039; AND ProcessId != &quot; DllCall(&quot;GetCurrentProcessId&quot;)
WMI := ComObjGet(&quot;winmgmts:&quot;).ExecQuery(Query)
For Proc In WMI
{
    RegExMatch(Proc.CommandLine, &quot;Si).*&quot;&quot;(?&lt;Folder&gt;.*?:.*)\\(?&lt;Name&gt;.*)\.ahk&quot;&quot;&quot;, _)
    Date := SubStr(Proc.CreationDate, 1, 14)
    FormatTime, Time, %Date%, HH:mm:ss ; dd-MM
    If _Name In %IgnoreList%
        Continue
    Process[A_Index] := [_Name, Time, _Folder, Proc.ProcessId], ++Count
}
DeleteDummyIcons()
If !Count
{ 
    MsgBox, 4149,  AhkTask, AutoHotkey process not found!
    IfMsgBox Retry
        Reload 
    ExitApp
}
RC := Count &gt; LimitRow ? LimitRow : Count

Gui, Font, s10
Gui, Margin, 0, 0
Gui, -DPIScale +AlwaysOnTop
Gui, Add, ListView, AltSubmit Grid vLV hwndhLV BackgroundE8E8FF R%RC%, Name|TimeCreate|Folder|PID
Gui, Add, Text, y+2 vBut1 Border +0x201 gClose, Close
Gui, Add, Text, x+0 vBut2 Border +0x201 hp gOpenFolder, In Folder
Gui, Add, Text, xm y+2 vBut3 Border +0x201 hp gSelectAll, Select All
Gui, Add, Text, x+0 vBut4 Border +0x201 hp gReload, Reload

For k, v in Process
    LV_Add(&quot;&quot;, v[1], v[2], v[3], v[4])

GuiControl, -Redraw, LV
Loop % LV_GetCount(&quot;Col&quot;)
    LV_ModifyCol(A_Index, &quot;AutoHdr&quot;) 
LV_InsertCol(LV_GetCount(&quot;Col&quot;)+1), LV_ModifyCol(LV_GetCount(&quot;Col&quot;)-1, &quot;AutoHdr&quot;), LV_DeleteCol(LV_GetCount(&quot;Col&quot;))
    LV_Modify(1, &quot;Select&quot;), LV_ModifyCol(2, &quot;SortDesc&quot;)
GuiControl, +Redraw, LV

Loop % 4 + (Width := 0)
{
    SendMessage, 4125, A_Index - 1, 0, , ahk_id %hLV%
    Width += ErrorLevel
}
Width += (Count &gt; LimitRow ? 26 : 4)
GuiControl, Move, LV, % &quot;w&quot; Width
Loop 4
    GuiControl, Move, But%A_Index%, % &quot;w&quot; Width // 2 &quot; x&quot; Width // 2 * (Mod(A_Index+1, 2))
Gui, Show, % &quot;xCenter y100 w&quot; Width, AhkTask
OnMessage(0x203, &quot;WM_LBUTTONDBLCLK&quot;)
Return

Close:
    Critical
    Loop % S := LV_GetCount(&quot;S&quot;)
    {
        sRow := LV_GetNext()
        LV_GetText(sPID, sRow, 4)
        Process, Close, %sPID%
        Process, WaitClose, %sPID%, 1
        If !ErrorLevel
            LV_Delete(sRow), DeleteDummyIcons()
    }
    If S = 1
        LV_Modify(LV_GetCount() &lt; sRow ? LV_GetCount() : sRow, &quot;Select&quot;)
    Return

OpenFolder:
    Loop % LV_GetCount(&quot;S&quot;) + (sRow := 0)
    {
        sRow := LV_GetNext(sRow)
        LV_GetText(sFolder, sRow, 3)
        LV_GetText(sName, sRow, 1)
        SelectFilePath(sFolder &quot;\&quot; sName &quot;.ahk&quot;)
    }
    Return

SelectAll:
    LV_Modify(0, &quot;Select&quot;)
    Return

Reload:
    Reload
    Return

GuiClose:
GuiEscape:
    ExitApp

WM_LBUTTONDBLCLK()  {
    If InStr(A_GuiControl, &quot;But&quot;)
    {
        If A_GuiControl = But1
            SetTimer, Close, -1
        Return 0
    }
}

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, %A_WinDir%\explorer.exe /select`, &quot;%FilePath%&quot;, , UseErrorLevel
}  
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-27T23:26:58Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83407#p83407</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83403#p83403" />
			<content type="html"><![CDATA[<p>Хорошая идея для работы с проблемным скриптом.&nbsp; Только не знаю будет ли это работать, когда простой &quot;ExitApp&quot; не станет.</p>]]></content>
			<author>
				<name><![CDATA[Next]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=28517</uri>
			</author>
			<updated>2014-05-27T21:13:25Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83403#p83403</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрещение вывода сообщений. Закрытие после сбоя]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83393#p83393" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Next пишет:</cite><blockquote><p>2. Интересует этот вопрос и для скриптов скомпилированных&nbsp; и нет. Как можно воспользоваться этими перменными, если скрипт выдал ошибку и не откликается?</p></blockquote></div><p>Кажется, есть общее решение:<br /></p><div class="codebox"><pre><code>DetectHiddenWindows, On
1:: ; Нажмите на единичку, чтобы убить собственный процесс скрипта
Sleep, 3000
Soundbeep
WinGet, OutputVar, PID, ahk_id %A_ScriptHwnd%
Process, Close, %OutputVar%
Return</code></pre></div><p>Если скрипт не откликается (завис наглухо), естественно, сам себе он не поможет. Но &quot;не откликаться&quot; можно по-разному.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-05-27T17:21:18Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83393#p83393</id>
		</entry>
</feed>
