Need Help With Simple Code Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Posts: 2
Joined: 12 Aug 2017, 23:52

Need Help With Simple Code

13 Aug 2017, 00:16

Hello, everyone. New guy here with AHK and to the forums. I have a fairly simple task that I'm trying to automate that I can't seem to nail down correctly. I've spent the last couple hours searching around on Google and trying different suggestions from older posts, but it's not working correctly.

So the goal of what I'm trying to accomplish is relatively simple in theory, but I may not be going about this with the correct method. I play Playerunknown's Battlegrounds (game for those of you who don't know it) which requires me to change my default audio device on Win 7 to my headphones everytime I want to play. It's a pain in the ass. So I figured I could just automate this with Autohotkey. All I've seen for the most part are hotkey scripts. I'm looking for a shortcut related script.

For instance:

Start PUBG from desktop shortcut
AHK script runs - changes default sound to headphones via batch file
Once I exit PUBG - changes default sound back to my Amp via batch file

Simple as that. So to do this I've opted to use Nircmd so I don't have to see the sound window popup and such. So far this is what I've got..

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

So what happens with this right now is, when I activate my PUBG window it runs my headphone batch file and changes the sound no problem. But then it also runs my amp batch file to change it back to my speakers right after..even with the game running which is not what I want. I want that to happen after I exit the game. So I need it to check and see if the game is running, not just an active window before switching back to my speakers. I would really appreciate input on how to fix this!
User avatar
Posts: 763
Joined: 02 Oct 2015, 12:15

Re: Need Help With Simple Code  Topic is solved

13 Aug 2017, 02:52

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Posts: 2
Joined: 12 Aug 2017, 23:52

Re: Need Help With Simple Code

13 Aug 2017, 18:32

Yes, thank you!

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], buttshark, TAC109, thenasos, Yahoo [Bot] and 18 guests