Playing a WAV file with a keystroke combination

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Scr1pter
Posts: 1278
Joined: 06 Aug 2017, 08:21
Location: Germany

Playing a WAV file with a keystroke combination

06 Aug 2017, 08:34

Hello,

I would like to play a specific sound file by pressing a keystroke combination like Ctrl+Shift+F11.
Important for me is that the sound file does not get opened, but only played.
(The same as a Windows system sound like Starting windows.)

Is that possible with the AHK function "SoundPlay"?
I haven't installed AHK yet, and probably I'll need some time until my first script will work.

My main aim is to switch between JoyToKey gamepad profiles (using as remote control) by pressing 1 button (which will be the keystroke combination).
The sound file will inform me which profile has been loaded.
The switchting between profiles already works - only the sound is missing.

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Playing a WAV file with a keystroke combination

06 Aug 2017, 08:42

Yes, you can use SoundPlay for that. Your hotkey would be ~^+F11:: it sounds like. The ^ = Ctrl, the + = Shift, and the ~ = pass-through. So if you use Ctrl+Shift+F11 in your game/program, you want to preserve that original function. Without ~, AHK would completely intercept the hotkey and AHK would only play sound, but not let the program change profiles.
User avatar
Scr1pter
Posts: 1278
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Playing a WAV file with a keystroke combination

06 Aug 2017, 08:47

Ok, I will try it!
Thanks for the super fast answer ;)
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], peter_ahk and 338 guests