<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17370&amp;type=atom" />
	<updated>2022-09-15T02:38:12Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=17370</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154754#p154754" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />Спасибо за уточнение.</p>]]></content>
			<author>
				<name><![CDATA[Clannad5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39853</uri>
			</author>
			<updated>2022-09-15T02:38:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154754#p154754</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154753#p154753" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Clannad5 пишет:</cite><blockquote><p>вроде там учитывается кодировка</p></blockquote></div><p>Ничего там не учитывается.<br />Всегда будет &quot;W&quot;.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2022-09-14T19:37:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154753#p154753</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154752#p154752" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Clannad5 пишет:</cite><blockquote><p><strong>teadrinker</strong><br /><a href="https://hotkeyit.github.io/v2/docs/commands/WinApi.htm">https://hotkeyit.github.io/v2/docs/commands/WinApi.htm</a></p></blockquote></div><p>Не знал про эту фичу, забавно. Но GetCommandLine — это не название какого-то метода AHK, это просто пример вызова winapi-функции, которая как раз так и называется. Но это, по-моему, только в AHK_H, в обычном такого нет.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-09-14T18:52:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154752#p154752</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154751#p154751" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong><br />Почему же, работает.<br />Я выше пример готовый приводил:<br /></p><div class="codebox"><pre><code>
Sound := FileRead(&quot;C:\1.wav&quot;, &quot;RAW&quot;)
PlaySound(Sound)
Sleep 1000

PlaySound( Sound ) {
	Return DllCall(&quot;winmm.dll\PlaySound&quot; ( 1 ? &quot;W&quot; : &quot;A&quot; ), &quot;Ptr&quot;, Sound, &quot;UInt&quot;, 0
	, &quot;UInt&quot;, ((SND_MEMORY:=0x4)|(SND_NODEFAULT:=0x2)))
	}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Clannad5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39853</uri>
			</author>
			<updated>2022-09-14T18:40:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154751#p154751</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154750#p154750" />
			<content type="html"><![CDATA[<p>Хм, а что DllCall в v2 не работает?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2022-09-14T18:31:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154750#p154750</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154749#p154749" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br /><a href="https://hotkeyit.github.io/v2/docs/commands/WinApi.htm">https://hotkeyit.github.io/v2/docs/commands/WinApi.htm</a></p>]]></content>
			<author>
				<name><![CDATA[Clannad5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39853</uri>
			</author>
			<updated>2022-09-14T18:23:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154749#p154749</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154748#p154748" />
			<content type="html"><![CDATA[<p>А что за метод GetCommandLine? Я в справке такого не нашёл.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-09-14T14:09:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154748#p154748</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154747#p154747" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong></p><p>Честно без понятия, вроде там учитывается кодировка, не буду врать и придумывать.<br />Однако я покопался еще и нашел метод, который уже встроен в AHK v2 &quot;GetCommandLine&quot;, который вызывает методы WinApi.</p><p>Сократил по итогу код в две строчки:</p><div class="codebox"><pre><code>
Sound := FileRead(&quot;C:\1.wav&quot;, &quot;RAW&quot;)
PlaySound(Sound, 0, 0x4|0x2)
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Clannad5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39853</uri>
			</author>
			<updated>2022-09-14T13:33:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154747#p154747</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154746#p154746" />
			<content type="html"><![CDATA[<p>А что означает ( 1 ? &quot;W&quot; : &quot;A&quot; ) и зачем оно нужно?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-09-14T13:13:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154746#p154746</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=154745#p154745" />
			<content type="html"><![CDATA[<p>Здравствуйте!</p><p>Возможно это не совсем подходящий форум по вопросам AHK V2, но всё же вопрос идёт с проблемой вызова Playsound, может быть знающие смогут мне объяснить, почему функция отказывается принимать мой файл, который я поместил в буфер?</p><p>Это метод воспроизведения для AHK_L:</p><div class="codebox"><pre><code>
fileread,sound,*c C:\Windows\Media\notify.wav
PlaySound(sound)
Sleep, 1000
ExitApp

PlaySound(sound) {
	DllCall(&quot;winmm.dll\PlaySound&quot;,&quot;uint&quot;,&amp;sound,&quot;uint&quot;,0,&quot;uint&quot;,0x4)
	}
</code></pre></div><p>В AHK_L Функция PlaySound спокойно принимает буфер данные, используя на конце код 0x4.</p><p>Используя AHK_H V2, я сталкиваюсь с некоторыми проблемами:</p><div class="codebox"><pre><code>
sound := fileread(&quot;C:\Windows\Media\notify.wav&quot;, &quot;RAW&quot;)
PlaySound(sound)
Sleep 1000
ExitApp

PlaySound(sound) {
	DllCall(&quot;winmm.dll\PlaySound&quot;,&quot;uint&quot;,&amp;sound,&quot;uint&quot;,0,&quot;uint&quot;,0x4)
	}
</code></pre></div><p>Мне пишет:</p><p><span class="postimg"><img src="https://i.imgur.com/fl5YN57.png" alt="https://i.imgur.com/fl5YN57.png" /></span></p><p>Что же я делаю не так?Возможно AHK_H V2 передаёт параметры неправильно?Или я делаю что-то не так?</p><p>UPD:</p><p>На зарубежном форуме мне помогли найти ответ:</p><div class="codebox"><pre><code>
Sound := FileRead(&quot;C:\1.wav&quot;, &quot;RAW&quot;)
PlaySound(Sound)
Sleep 1000

PlaySound( Sound ) {
	Return DllCall(&quot;winmm.dll\PlaySound&quot; ( 1 ? &quot;W&quot; : &quot;A&quot; ), &quot;Ptr&quot;, Sound, &quot;UInt&quot;, 0
	, &quot;UInt&quot;, ((SND_MEMORY:=0x4)|(SND_NODEFAULT:=0x2)))
	}
</code></pre></div><p>Вопрос решён.</p>]]></content>
			<author>
				<name><![CDATA[Clannad5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39853</uri>
			</author>
			<updated>2022-09-14T12:47:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=154745#p154745</id>
		</entry>
</feed>
