- SoundPlay -Autohotkey
- Параметры
- ErrorLevel
- Примечания
- AHK: проигрывание звука при включении и Suspende скрипта
- Сообщения 6
- 1 Тема от sergeant.coolagin 2010-10-17 04:12:44
- Тема: AHK: проигрывание звука при включении и Suspende скрипта
- 2 Ответ от YMP 2010-10-17 07:51:50
- Re: AHK: проигрывание звука при включении и Suspende скрипта
- Soundplay ahk не работает
- Re: SoundPlay not working at all Topic is solved
- Soundplay ahk не работает
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Re: Soundplay not working
- Problem with SoundPlay
SoundPlay -Autohotkey
Проигрывает аудио- и видеофайлы, или файлы другого поддерживаемого формата.
Параметры
| Filename | Имя файла. Если не задан полный путь, файл ищется в папке, указанной в переменной A_WorkingDir. |
Для воспроизведения стандартных системных звуков задайте этот параметр в виде звёздочки с числом, как показано ниже. Заметьте, что параметр Wait в этом случае не действует.
*-1 Простой звук. Если звуковая карта недоступна, этот звук будет воспроизведён через динамик системного блока.
*16 Стоп/Ошибка
*32 Вопрос
*48 Восклицание
*64 Звёздочка (информация)
Какие файлы будут в этих случаях проигрываться, определяется настройкой системной звуковой схемы в диалоге «Звуки и аудиоустройства».
Известные ограничения: если параметр Wait опущен, операционная система иногда может воспринимать проигрываемый файл как занятый до тех пор, пока скрипт не будет закрыт или пока не будет проигран другой файл (даже несуществующий).
ErrorLevel
Нуль, если команда выполнена успешно. Иначе 1.
Примечания
Все операционные системы Windows могут проигрывать wav-файлы. Однако файлы других форматов (mp3, avi и т.д.) могут требовать установки соответствующих кодеков.
Если скрипт, воспроизводящий файл, начнёт проигрывать другой файл, воспроизведение первого файла будет остановлено. На некоторых системах файлы определённых форматов могут останавливаться, даже если проигрывание второго файла начато не тем же самым, а другим скриптом.
Чтобы остановить проигрывание файла, используйте команду SoundPlay с несуществующим файлом в качестве параметра.
Если работа скрипта завершается, воспроизведение любого файла, запущенное этим скриптом, останавливается.
Источник
AHK: проигрывание звука при включении и Suspende скрипта
Чтобы отправить ответ, вы должны войти или зарегистрироваться
Сообщения 6
1 Тема от sergeant.coolagin 2010-10-17 04:12:44
- sergeant.coolagin
- Участник
- Неактивен
- Рейтинг : [ 0 | 0 ]
Тема: AHK: проигрывание звука при включении и Suspende скрипта
Вот что сам смог написать. Проигрывается звук и скрипт саспендится. После этого я не могу включить скрипт этой же кнопкой. Нужно, чтобы при саспенде скрипта проигрывался 1 звук, а при включении скрипта обратно проигрывался уже другой звук.
Помогите, пожалуйста.
2 Ответ от YMP 2010-10-17 07:51:50
- YMP
- Разработчик
- Неактивен
- Рейтинг : [ 136 | 0 ]
Re: AHK: проигрывание звука при включении и Suspende скрипта
Порядок имеет значение. Что-нибудь вроде этого.
Источник
Soundplay ahk не работает
I was browsing the Ask For Help forum and looked at: https://autohotkey.com/boards/viewtopic.php?f=5&t=26326. I’ve never used SoundPlay before so copied and ran garry’s first code snippet (using an MP3 file I copied to the root of C: and renamed to test.mp3). It didn’t work.
I did a search of the forum and found a recent post (https://autohotkey.com/boards/viewtopic . ot+working) from another user who had the same issue. He/she ended up using SoundBeep instead.
I went back to basics and copied the 1st example from the SoundPlay documentation, i.e. SoundPlay, %A_WinDir%\Media\ding.wav . It didn’t work (even though I checked that ding.wav existed and played using Media Player). I tried again using SoundPlay, %A_WinDir%\Media\notify.wav instead, on the basis that it was of longer duration. It didn’t work.
I tried again after disabling Avira and Malwarebytes Anti-Malware. It didn’t work.
I re-started my PC and tried again. It didn’t work.
I tried the 2nd example from the SoundPlay documentation, i.e. SoundPlay *-1 . This worked!
I updated from AHK 1.1.24.01 to 1.1.24.04 just in case but to no avail.
I am really confused why SoundPlay won’t play MP3 or WAV files when I’ve confirmed:
- Sound is not muted.
Volume is mid-level.
The files exist.
The files play in Media Player, VLC, etc. without issue.
I’m using AHK 1.1.24.04 (Unicode x32) in Windows 7 Pro SP1. (I also tried on a Windows 10 PC and the same script wouldn’t play either MP3 or WAV files. Again, only SoundPlay *-1 worked.)
I must be doing something stupid but I can’t for the life of me work out why SoundPlay, %A_WinDir%\Media\notify.wav doesn’t work.
Edit: If I just run the code (either from within SciTE4AutoHotkey or just double-clicking on the AHK file then I see a flash in the Notification Area as the script executes and closes. If, within SciTE, I use Tools > Debug (F7) then use Run current line of code (F10) twice (i.e. press F10 twice) then notify.wav does play.
Re: SoundPlay not working at all Topic is solved
I think the issue might be the script is exiting before the sound is playing.
The workarounds I can think of:
- If suitable, use #Persistent and exit the script yourself
- Likewise, if suitable, have SoundPlay block the script until the sound has finished playing and have the script exit itself:
Источник
Soundplay ahk не работает
Soundplay has stopped working on my system. I’ve tried 2 different approaches to play a .wav file:
Every script in my collection that used soundplay has stopped playing the sounds all of a sudden. Soundbeep works, however.
My guess is that it’s either something to do with AHK or is it perhaps a soundcard issue? I have ensured that AHK’s volume is at 100% via the sound control panel.
Otherwise, all music/sounds, etc. play normally on my PC as they should — there are no other audio problems or issues on my computer.
Is this a familiar problem with a fix?
Re: Soundplay not working
If it worked before and stopped suddenly but you didn’t update AHK. it most likely has a non-AHK reason. (I know of no related bug.)
Have you tried it with a mp3 instead?Is Errorlevel = 1 ?
Does SoundPlay *-1 beep?Re: Soundplay not working
No, SoundPlay *-1 does not make any sounds. MP3 files don’t work either.
the messagebox returns 0.
This is bizarre — all other sound is totally fine on my system.
Re: Soundplay not working
Re: Soundplay not working
There is no sound.
The messagebox returns:
Re: Soundplay not working
Re: Soundplay not working
thanks jeeswg, appreciated. I am on Windows7 64-Bit. I am running AHK version 1.1.22.03 (Unicode 32-bit). This is actually a problem that happened many months ago, but only now am I tackling it. Soundplay used to work perfectly, but somewhere along the lines something has gone wrong. Restarting the PC makes no difference.
Should I be upgrading/changing my version of AHK maybe?
Re: Soundplay not working
Re: Soundplay not working
Re: Soundplay not working
Re: Soundplay not working
Re: Soundplay not working
Re: Soundplay not working
Okay, here’s a very strange update:
I own a Logitech Headset, model #H800
it opens my system output sound properties. My default playback mode is:
Speakers
Realtek High Definition Audio
Default Deviceand in this mode, my system sound works perfectly. However, AHK will not play any sounds in this mode.
BUT- if I change my output sound properties to:
Speakers
Logi H800 Headset
Default Device. then I can hear all AHK sounds using soundplay through my headset.
This is totally bizarre. What could be causing this?
Источник
Problem with SoundPlay
I am unable to play sound files (even .wav’s) using SoundPlay. I have tried using files located in the Windows\Media folder as well as the script’s local folder, but neither works.
So basically, doesn’t play any sound. However, the ErrorLevel is 0.The following, and other standard system sounds, as documented in the AHK help, do work though.Goes without saying that I can play wav, mp3, etc files normally on my system using windows media player, etc.
Using latest AHK_L unicode and Windows 7 x64
- Members
- 800 posts
Last active: Dec 17 2014 07:22 AM - Joined: 16 Feb 2010
I actually attempted to get this working too earlier tonight, but had no luck except with the asterisk trigger sounds. A lot of the Sound commands are buggy now, and I am assuming this is following that example, although the documentation doesn’t say anything about new operating systems having issues with it. If anyone has found a way to make this work with windows 7, I am curious how to also.
Also, if you really need this desperately, I am sure a DLLcall could do it too. Here is an MSDN function which could.
- Members
- 95 posts
Last active: Jan 04 2013 03:35 PM - Joined: 18 Jul 2011
- Members
- 754 posts
Last active: Jan 17 2015 02:38 AM - Joined: 31 Oct 2008
That doesn’t work for me too, however a simple call of win api will work.
- Members
- 754 posts
Last active: Jan 17 2015 02:38 AM - Joined: 31 Oct 2008
- Members
- 447 posts
Last active: Oct 03 2013 08:40 PM - Joined: 17 Nov 2011
I am using a script with the SoundPlay command, too and for me it works.
But since my soundplay should use different paths to play, I used a variable where I stored the file’s (mp3 in this case) path in.
- Members
- 800 posts
Last active: Dec 17 2014 07:22 AM - Joined: 16 Feb 2010
@aRt)Y What operating system are you using? I have tired with and without a variable. The commands execute fine with a run command, but obviously I don’t want to bring up the default player to play them. I just know my path works fine because of that and it must have to do with the command.
@Zaelia I tried using multiple versions of the Dll call to play a sound and it didn’t work with that Dll function. The function returns 1 (true) which the documentation says means the sound was played successfully, however I hear nothing. I tried both PlaySound A and PlaySound W with no success (though I know I am not using Unicode). Did you run your code, and did it work for you?
- Members
- 775 posts
Last active: Mar 06 2014 11:02 AM - Joined: 07 Aug 2011
Both of this works for me in Win7.
- Members
- 754 posts
Last active: Jan 17 2015 02:38 AM - Joined: 31 Oct 2008
- Members
- 447 posts
Last active: Oct 03 2013 08:40 PM - Joined: 17 Nov 2011
@aRt)Y What operating system are you using? I have tired with a nd without a variable. The commands execute fine with a run command, but obviously I don’t want to bring up the default player to play them. I just know my path works fine because of that and it must have to do with the command.
Eh, my script won’t run the media player when I use SoundPlay.
The music plays in the background — I can even use the media player and play 2 songs.
- Members
- 800 posts
Last active: Dec 17 2014 07:22 AM - Joined: 16 Feb 2010
@aRt)Y I meant it runs via media player when I use the Run command because media player is my default player. I know then what the file sounded like and the path to it was correct because the run command played the file just fine.
@Zaelia I also tried with chord.wav (which is a bit more intrusive to the ears) and neither of them played. I use AHK basic and windows 7 (32-bit). I ran the code you just posted and it doesn’t make sound either. I also included the persistent command, even in the first set of tests I did.
@himanshu Did you try the DLLcall and did it function correctly for you?
I am really stumped on why this is not working for me. It goes against all documentation in AHK and the MSDN documentation for the DLLcall. It doesn’t give me confidence to ever use these commands/functions even if I do manage to get them to function. If I am having trouble with it in my own script, odds are someone else is going to have trouble too if they use it.
Источник
- Sound is not muted.