Jump to content
Sign in to follow this  

Sound Device Change Script Help

Recommended Posts



I had a problem that when I unplugged my external speakers (I have a laptop), the volume indicator got messed up. When I restarted ehtray.exe in Process Explorer, the volume indicator problem was fixed. A very helpful person at the Piriform Forums helped me create a batch file that restarts ehtray.exe (ehtray is a application in Windows XP Media Center that is used for the actual media center portion of the OS and as the on screen volume indicator - the green bars) and Winamp (if it is running at the time the batch file is written). Here's the code for the batch file:

taskkill /im ehtray.exe /F
start C:\WINDOWS\ehome\ehtray.exe
taskkill /im "winamp.exe" /F
if %errorlevel%==0 (start /d "C:\Program Files\Winamp" winamp.exe)

I wanted to add the following to the batch file:

  • I would like to make the batch file automatically run on a sound device change.

  • I would like Winamp to resume playing the track at the time it left off at when the batch file runs when Winamp restarts. Winamp has a hotkey "Ctrl + J" that is used to jump to a time in the track. It brings up a window that shows the current time in a text box. I would like to create a variable that could save the time and then place that value in the time in the text box after Winamp has started again. I can also create a global hotkey in Winamp's preferences that does the same function so that Winamp would not have to be the active window for the hotkey (Ctrl + J) to work.

  • When Winamp is forcefully restarted the current song playing is not the song that is active when Winamp starts again. I would also need to save the song title and artist to a variable. In order to do so, I would need to distinguish among different text boxes in a single window.

The person said that a batch file would not be able to do all of the things I wanted to do, but suggested I ask on the AutoIt forums for help to make a script with AutoIt. Can anyone help me out?

Share this post

Link to post
Share on other sites


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this