MP3 player Hotkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
nikolapfc89
Posts: 5
Joined: 03 Mar 2019, 11:21

MP3 player Hotkey

Post by nikolapfc89 » 03 Mar 2019, 11:41

Hi guys, great work with AHK. But i need to make it more useful for me and i am not good about scripts.

I created script with hotkeys to play chants in mp3 player when playing football video game (FIFA).

I created shortcut (SHIFT+F3 play/stop song and SHIFT+F1 next song). I open mp3 player insert chants then in game without minimizing screen i can switch between chants with hotkeys.

But is somehow possible, to create hotkey to play one special song at the moment and then switch back to playlist? I want to have goal song so when i score goal i want to use hotkey to play song after goal and after replays, i want to switch to chants playlist. All that without minimizing screen.

Thanx!

User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: MP3 player Hotkey

Post by Scr1pter » 03 Mar 2019, 19:35

Hi and welcome,

You could try it SoundPlay.
In your script, it could look like this:

Code: Select all

F8:: ; Change key to whatever you want
Send {Media_Play_Pause} ; Pause current song
SoundPlay, C:\Windows\Media\tada.wav ; Change to the path of your special goal song
Sleep, 5000 ; This value (milliseconds) should be at least as long as your goal song
Send {Media_Play_Pause} ; Continue other song
return
If you have problems with {Media_Play_Pause}, you can work with Media_Stop and {Media_Play_Pause}

Cheers!
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

nikolapfc89
Posts: 5
Joined: 03 Mar 2019, 11:21

Re: MP3 player Hotkey

Post by nikolapfc89 » 04 Mar 2019, 00:43

Scr1pter wrote:
03 Mar 2019, 19:35

If you have problems with {Media_Play_Pause}, you can work with Media_Stop and {Media_Play_Pause}

Cheers!
Works great thank you! :bravo:
What shoud i add to lines if i want to stop goal song immediately? I tried like this
+F8:: ; Change key to whatever you want
Send {Media_Play_Pause} ;
SoundPlay, D:\FIFA 16 MODS & ADDONS\FIFA\Chants\Entrances and hymnes\Panathinaikos.mp3 ;
Sleep, 5000 ; This value (milliseconds)
Send {Media_Stop} ;
return
but with media_stop script only stop current playlist and goal song is go into background. I can limit mp3 files to less seconds, but is possible somehow to stop that soundplay with shortcut?

User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: MP3 player Hotkey

Post by Scr1pter » 04 Mar 2019, 05:30

You could use SoundPlay again but choose a file which doesn't exist.
By this way, AHK will stop the goal song and then try to play the other file.
However, I'm not really sure if it's a good solution,
because there is still the sleep time...

Another way could be to use reload.
So those could be the scripts you can try out:

Code: Select all

F9::
SoundPlay, fake.wav ; Play non existent file to interrupt current Sound Play
return

F10::
Send {Media_Play_Pause} ; Resume real song
reload ; Reload whole AHK script
Cheers!
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

nikolapfc89
Posts: 5
Joined: 03 Mar 2019, 11:21

Re: MP3 player Hotkey

Post by nikolapfc89 » 04 Mar 2019, 12:40

Thanx mate, works like a charm!
With those scripts i can make everything i want to. :bravo:

nikolapfc89
Posts: 5
Joined: 03 Mar 2019, 11:21

Re: MP3 player Hotkey

Post by nikolapfc89 » 08 Aug 2019, 19:09

Hey i have another question.

I have script so i can change music while play games in my mp3 player (like SHIFT+F1 = next). Is possible to assing shortcut on my joypad/controller to work like that as script? For example start+ some button play next song :?:
How script should look?

This is my current one for keyboard
+F1:: ;the + means shift
Send {Media_Next}
return

;play/pause
+F3::
Send {Media_Play_Pause}
return

+F5::
Send {Media_Stop}
return

nikolapfc89
Posts: 5
Joined: 03 Mar 2019, 11:21

Re: MP3 player Hotkey

Post by nikolapfc89 » 09 Oct 2019, 23:16

Anyone have solution how to assign hotkey for xbox one controller on pc to change song in mp3 player?

Stinjere
Posts: 19
Joined: 28 Nov 2022, 02:00

Re: MP3 player Hotkey

Post by Stinjere » 29 Nov 2022, 18:33

How do I make this audio file play with a volume of 5% (I mean only the file, not the system sound)
what is the command?

Post Reply

Return to “Ask for Help (v1)”