<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Как скрыть иконку из нижней панели.]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=13936</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13936&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Как скрыть иконку из нижней панели.».]]></description>
		<lastBuildDate>Fri, 13 Jul 2018 15:00:29 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Как скрыть иконку из нижней панели.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=127033#p127033</link>
			<description><![CDATA[<div class="codebox"><pre><code>DetectHiddenWindows, On
PID := ExecScript(&quot;#Persistent&quot;)
WinWait, ahk_pid %PID%
newScriptHwnd := WinExist()
OnExit( Func(&quot;CloseChildScript&quot;).Bind(newScriptHwnd) )

Sleep, 2000
TrayIconActions(&quot;delete&quot;, &quot;&quot;, newScriptHwnd)

Sleep, 2000
RestoreTrayIcon(newScriptHwnd)

Sleep 2000
ExitApp

TrayIconActions(command := &quot;delete&quot;, hIcon := &quot;&quot;, hWnd := &quot;&quot;, uID := 0x404, nMsg := 0x404)
{
   static NIF_MESSAGE := 1, NIF_ICON := 2, NIM_ADD := 0, NIM_MODIFY := 1, NIM_DELETE := 2
   (hWnd = &quot;&quot; &amp;&amp; hWnd := A_ScriptHwnd)
   uFlags := (command = &quot;add&quot; ? NIF_MESSAGE : 0) | (command != &quot;delete&quot; ? NIF_ICON : 0)
   action :=  command = &quot;add&quot; ? NIM_ADD : command = &quot;modify&quot; ? NIM_MODIFY : NIM_DELETE
   
   VarSetCapacity(NOTIFYICONDATA, size := A_PtrSize = 8 ? 848 : A_IsUnicode? 828 : 444, 0)
   NumPut(size, NOTIFYICONDATA, &quot;UInt&quot;)
   NumPut(hWnd, NOTIFYICONDATA, A_PtrSize)
   NumPut(uID,  NOTIFYICONDATA, A_PtrSize*2)
   ( command = &quot;add&quot; &amp;&amp; NumPut(nMsg, NOTIFYICONDATA, A_PtrSize*2 + 8, &quot;UInt&quot;) )
   if (command != &quot;delete&quot;)  {
      NumPut(uFlags, NOTIFYICONDATA, A_PtrSize*2 + 4, &quot;UInt&quot;)
      NumPut(hIcon,  NOTIFYICONDATA, A_PtrSize*3 + 8)
   }
   DllCall(&quot;shell32\Shell_NotifyIcon&quot;, UInt, action, Ptr, &amp;NOTIFYICONDATA)
}

RestoreTrayIcon(scriptHwnd) {
   static WM_TASKBARCREATED := DllCall(&quot;RegisterWindowMessage&quot;, Str, &quot;TaskbarCreated&quot;)
   DllCall(&quot;PostMessage&quot;, Ptr, scriptHwnd, UInt, WM_TASKBARCREATED, Ptr, 0, Ptr, 0)
}

ExecScript(script)  {
   shell := ComObjCreate(&quot;WScript.Shell&quot;)
   exec := shell.Exec(&quot;AutoHotkey.exe /ErrorStdOut *&quot;)
   exec.StdIn.Write(script)
   exec.StdIn.Close()
   Return exec.ProcessID
}

CloseChildScript(hWnd)  {
   WinClose, ahk_id %hWnd%
}</code></pre></div><p>Или так:<br /></p><div class="codebox"><pre><code>DetectHiddenWindows, On
PID := ExecScript(&quot;#Persistent&quot;)
WinWait, ahk_pid %PID%
newScriptHwnd := WinExist()
OnExit( Func(&quot;CloseChildScript&quot;).Bind(newScriptHwnd) )

Sleep, 2000
TrayIconActions(&quot;delete&quot;, &quot;&quot;, newScriptHwnd)

Sleep, 2000
TrayIconActions(&quot;add&quot;, LoadPicture(A_AhkPath, &quot;Icon1 w16 h-1&quot;, IMAGE_ICON := 1), newScriptHwnd)

Sleep 2000
ExitApp

TrayIconActions(command := &quot;delete&quot;, hIcon := &quot;&quot;, hWnd := &quot;&quot;, uID := 0x404, nMsg := 0x404)
{
   static NIF_MESSAGE := 1, NIF_ICON := 2, NIM_ADD := 0, NIM_MODIFY := 1, NIM_DELETE := 2
   (hWnd = &quot;&quot; &amp;&amp; hWnd := A_ScriptHwnd)
   uFlags := (command = &quot;add&quot; ? NIF_MESSAGE : 0) | (command != &quot;delete&quot; ? NIF_ICON : 0)
   action :=  command = &quot;add&quot; ? NIM_ADD : command = &quot;modify&quot; ? NIM_MODIFY : NIM_DELETE
   
   VarSetCapacity(NOTIFYICONDATA, size := A_PtrSize = 8 ? 848 : A_IsUnicode? 828 : 444, 0)
   NumPut(size, NOTIFYICONDATA, &quot;UInt&quot;)
   NumPut(hWnd, NOTIFYICONDATA, A_PtrSize)
   NumPut(uID,  NOTIFYICONDATA, A_PtrSize*2)
   ( command = &quot;add&quot; &amp;&amp; NumPut(nMsg, NOTIFYICONDATA, A_PtrSize*2 + 8, &quot;UInt&quot;) )
   if (command != &quot;delete&quot;)  {
      NumPut(uFlags, NOTIFYICONDATA, A_PtrSize*2 + 4, &quot;UInt&quot;)
      NumPut(hIcon,  NOTIFYICONDATA, A_PtrSize*3 + 8)
   }
   DllCall(&quot;shell32\Shell_NotifyIcon&quot;, UInt, action, Ptr, &amp;NOTIFYICONDATA)
}

ExecScript(script)  {
   shell := ComObjCreate(&quot;WScript.Shell&quot;)
   exec := shell.Exec(&quot;AutoHotkey.exe /ErrorStdOut *&quot;)
   exec.StdIn.Write(script)
   exec.StdIn.Close()
   Return exec.ProcessID
}

CloseChildScript(hWnd)  {
   WinClose, ahk_id %hWnd%
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 13 Jul 2018 15:00:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=127033#p127033</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как скрыть иконку из нижней панели.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=127031#p127031</link>
			<description><![CDATA[<p>Почему не уверены?<br /><strong>Lexikos</strong> же пишет:<br /></p><div class="quotebox"><blockquote><p>For scripts, there&#039;s a very easy alternative: call Menu Tray, NoIcon. To trigger it from another script, you only need a few lines of code to define a function and register it with OnMessage.</p></blockquote></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Fri, 13 Jul 2018 14:00:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=127031#p127031</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как скрыть иконку из нижней панели.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=127030#p127030</link>
			<description><![CDATA[<p>Не уверен, что это так. Вот тема обсуждалась похожая: <a href="https://autohotkey.com/boards/viewtopic.php?f=5&amp;t=23011&amp;hilit=HideTrayIcon">https://autohotkey.com/boards/viewtopic … deTrayIcon</a>.</p>]]></description>
			<author><![CDATA[null@example.com (svoboden)]]></author>
			<pubDate>Fri, 13 Jul 2018 13:51:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=127030#p127030</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как скрыть иконку из нижней панели.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=127026#p127026</link>
			<description><![CDATA[<p>С помощью <em>этих</em> функций можно скрыть/показать иконку другого скрипта.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 13 Jul 2018 02:40:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=127026#p127026</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как скрыть иконку из нижней панели.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=127023#p127023</link>
			<description><![CDATA[<p>Не понятно, а для чего тогда нужны эти функции, если можно так просто скрыть меню.</p>]]></description>
			<author><![CDATA[null@example.com (svoboden)]]></author>
			<pubDate>Thu, 12 Jul 2018 22:50:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=127023#p127023</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как скрыть иконку из нижней панели.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=127022#p127022</link>
			<description><![CDATA[<p>Скрыть/показать иконку скрипта проще так:</p><div class="codebox"><pre><code>Sleep 2000
Menu, Tray, NoIcon
Sleep 2000
Menu, Tray, Icon
Sleep 2000</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 12 Jul 2018 20:20:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=127022#p127022</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как скрыть иконку из нижней панели.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=127021#p127021</link>
			<description><![CDATA[<p>Если нужно запустить скрипт сразу скрытно, то читайте про директиву #NoTrayIcon.<br />Cкрыть/показать текущий скрипт можно так:<br /></p><div class="codebox"><pre><code>1::MsgBox

2::killTrayIcon(A_ScriptHwnd)
3::restoreTrayIcon(A_ScriptHwnd)

killTrayIcon(scriptHwnd) {
    DetectHiddenWindows, On
    Static NIM_DELETE := 2, AHK_NOTIFYICON := 1028
    VarSetCapacity(nic, size := 936 + 4 * A_PtrSize)
    NumPut(size, nic, 0, &quot;UInt&quot;)
    NumPut(scriptHwnd, nic, A_PtrSize)
    NumPut(AHK_NOTIFYICON, nic, A_PtrSize * 2, &quot;UInt&quot;)
    Return DllCall(&quot;Shell32\Shell_NotifyIcon&quot;, &quot;UInt&quot;, NIM_DELETE, &quot;Ptr&quot;, &amp;nic)
}

restoreTrayIcon(scriptHwnd) {
    DetectHiddenWindows, On
    WM_TASKBARCREATED := DllCall(&quot;RegisterWindowMessage&quot;, &quot;Str&quot;, &quot;TaskbarCreated&quot;)
    PostMessage, WM_TASKBARCREATED,,,, ahk_id %scriptHwnd%
}
</code></pre></div><p>А прочитать файл можно командной Loop, Read.</p>]]></description>
			<author><![CDATA[null@example.com (svoboden)]]></author>
			<pubDate>Thu, 12 Jul 2018 18:29:47 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=127021#p127021</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как скрыть иконку из нижней панели.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=127019#p127019</link>
			<description><![CDATA[<p>А также хотел бы узнать, как сделать, чтобы скрипт прочитал txt файл и вывел текст в msgbox.</p>]]></description>
			<author><![CDATA[null@example.com (morgan)]]></author>
			<pubDate>Thu, 12 Jul 2018 17:13:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=127019#p127019</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Как скрыть иконку из нижней панели.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=127017#p127017</link>
			<description><![CDATA[<p>Хотелось бы узнать, как можно скрыть иконку скрипта из нижней панели. Отправьте образец, буду очень вам благодарен.</p>]]></description>
			<author><![CDATA[null@example.com (morgan)]]></author>
			<pubDate>Thu, 12 Jul 2018 17:00:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=127017#p127017</guid>
		</item>
	</channel>
</rss>
