Post Reply

Forums -> UltraMon™ -> AutoIt script to change profile
Y.H   2012-07-05 23:00
Hey everybody,

I'm using a pc Monitor and I have an HDTV.
I used to have to set my default sound device to "ATI HDMI sound" manually. but fount a script for doing it in AutoIt and it's working great.

I want to write a script that:
1. will change my UltraMon profile
2. and then change the default sound device with my AutoIt script I found.

I figured out how to do the second part and it works.

Here's my question:
How to I write the command/script (whatever it is) to change my UltraMon profile?

Sorry for the long post, just wanted everything to be clear.

Thanks
Christian Studer   2012-07-06 08:42
Can you run other applications from your script? If yes, you'll need to run UltraMonShortcuts.exe and pass it the profile you want to load, like this:

"C:\Program Files\UltraMon\UltraMonShortcuts.exe" /l "C:\Users\<username>\AppData\Roaming\Realtime Soft\UltraMon\<version>\Profiles\My profile.umprofile"

Christian Studer - www.realtimesoft.com
Y.H   2012-07-06 21:52
Thank you. That did the trick. All is working.

I thought maybe I'll write down all the process. It could be helpful for other people.

I found a script online for switching the default sound device. this is the script:
;-----Configuration----- ;The title of the sound config window. Dim $ConfigWindowTitle = "Sound" ;-----End of configuration---- Dim $ItemNumber = 4 ; The first itme in the audio list If FileExists ("a") Then; Use the existence of a file to know if we should toggle FileDelete("a") $ItemNumber = 2 ; The audio playback device you want to toggle to Else FileOpen("a", 1) FileClose("a") EndIf Run("control mmsys.cpl") ;Run the sound control applet and hide it. WinWaitActive($ConfigWindowTitle) ;Wait for it to be active before sending keystrokes. Send("{TAB}{TAB}{TAB}{TAB}") ;Put the focus on the list For $i = 1 to $ItemNumber Step 1 Send("{DOWN}") Next Send("!s") ;Press Alt + S to set the selected device as the default. WinClose($ConfigWindowTitle)
Now, Make a new AutoIt V3 Script and Copy+Paste the above script. compile it to an EXE file and name it whatever you want. I named mine "Change Sound to HDTV"

Then, make a new TXT file and write the following:
@echo off. "C:\Program Files\UltraMon\UltraMonShortcuts.exe" /l "C:\Users\<username>\AppData\Roaming\Realtime Soft\UltraMon\<version>\Profiles\My profile.umprofile" start /d "<Full File Path>" Change Sound to HDTV.exe @echo off.

The full file path should be without the file name itself, just where the file is. After that you write the file name with the EXE. In my example it's "Change Sound to HDTV.exe"

Save the TXT file as All Files and change TXT to BAT.

That's it. Now when you click on the batch file it will change the profile and switch the sound to HDTV.
You can assign a HotKey for the file or make a nice desktop icon for it.


There is probably a faster and more efficient way to do this but this one works great as well
dssamusaran   2012-08-19 17:55
Hello,

I tried your method but have noticed a problem using it.

If you changed manually the audio device and next launch a profile that loads this device you'll end up with the sound control pannel still openned.

I browsed the web and since there's no way to switch audio device through registry since W7 SP1 I ended up using a little third party software.

I used Nirsoft's NirCmd (http://www.nirsoft.net/utils/nircmd.html) to do the trick with a .vbs script.

The script is based on the device name in the sound control pannel so it's not sensitive to the device position and the current activated device.


I will post the script back home =)
Forums -> UltraMon™ -> AutoIt script to change profile

Post Reply