<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>DisplayFusion RSS: Custom Script for Changing audio devices only when A headset is disconnected</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=129329ae-3816-4496-b6d5-3b6878a0ed7d" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=129329ae-3816-4496-b6d5-3b6878a0ed7d</link>
<description>DisplayFusion RSS: Custom Script for Changing audio devices only when A headset is disconnected</description>
<lastBuildDate>Thu, 07 May 2026 11:09:41 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=129329ae-3816-4496-b6d5-3b6878a0ed7d</generator>
<item>
<title>RE: Custom Script for Changing audio devices only when A headset is disconnected</title>
<link>https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#9</link>
<pubDate>Fri, 23 Dec 2022 02:34:05 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#9</guid>
<category>DisplayFusion</category>
<description><![CDATA[The delay did the trick! And the other macro works absolutely fantastic! Thank you so much for your help, Ive gotten it exactly where I want it! This is great.
Happy Holidays!]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
The delay did the trick! And the other macro works absolutely fantastic! Thank you so much for your help, Ive gotten it exactly where I want it! This is great.<br/>
<br/>
Happy Holidays!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Custom Script for Changing audio devices only when A headset is disconnected</title>
<link>https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#8</link>
<pubDate>Thu, 22 Dec 2022 18:30:02 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#8</guid>
<category>DisplayFusion</category>
<description><![CDATA[Strange, maybe it needs a delay in between setting each device. Can you try adding this line right before it tries to change the second device:
Code
Copy
Select All
BFS.General.ThreadWait(1000);]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Strange, maybe it needs a delay in between setting each device. Can you try adding this line right before it tries to change the second device: <br/>
<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code019e0221107d75e2933cec29d895a472" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019e0221107d75e2933cec29d895a472Js'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code019e0221107d75e2933cec29d895a472Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">BFS.General.ThreadWait(1000);</pre><textarea id="code019e0221107d75e2933cec29d895a472" name="code019e0221107d75e2933cec29d895a472" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Custom Script for Changing audio devices only when A headset is disconnected</title>
<link>https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#7</link>
<pubDate>Thu, 22 Dec 2022 15:47:50 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#7</guid>
<category>DisplayFusion</category>
<description><![CDATA[Ok great! Thanks so much. I am going to try this. I used to have it set the audio device by profile which worked but I wanted to include the exception for the headphones.
I have another thing to add on the above discussion regarding the communication device. I did add the script as described bel...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Ok great! Thanks so much. I am going to try this. I used to have it set the audio device by profile which worked but I wanted to include the exception for the headphones. <br/>
<br/>
I have another thing to add on the above discussion regarding the communication device. I did add the script as described below and it does seem to work, but only intermittenly. It runs fine if you run the function, and sometimes fine when you switch profiles. But I am noticing I am switching profiles and only the playback device is switching, not the communication device. Ive checked over it multiple times and it is right/working. Would you have any idea why this would occur and not 100% of the time?
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Custom Script for Changing audio devices only when A headset is disconnected</title>
<link>https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#6</link>
<pubDate>Thu, 22 Dec 2022 15:40:54 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#6</guid>
<category>DisplayFusion</category>
<description><![CDATA[Yep that's possible, I've attached a script below that will do that. You can input your monitor profile names and audio device names in the script, and copy the "Else if" section as many times as you would like for each monitor profile you have.
You can also assign audio devices to your montior ...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Yep that's possible, I've attached a script below that will do that. You can input your monitor profile names and audio device names in the script, and copy the "Else if" section as many times as you would like for each monitor profile you have. <br/>
<br/>
You can also assign audio devices to your montior profiles through the DisplayFusion Monitor Configuration window. It will load them each time the monitor profile is loaded, if that works for you.<br/>
<br/>
Thanks!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Custom Script for Changing audio devices only when A headset is disconnected</title>
<link>https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#5</link>
<pubDate>Wed, 21 Dec 2022 17:57:37 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#5</guid>
<category>DisplayFusion</category>
<description><![CDATA[Thanks so much, that did the trick! You guys are very helpful!
What about a script that runs with a button press, checks the Monitor Profile and selects the playback and communication devices based on which profile is active?
Would that work?]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Thanks so much, that did the trick! You guys are very helpful! <br/>
<br/>
What about a script that runs with a button press, checks the Monitor Profile and selects the playback and communication devices based on which profile is active?<br/>
Would that work?
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Custom Script for Changing audio devices only when A headset is disconnected</title>
<link>https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#4</link>
<pubDate>Wed, 21 Dec 2022 14:48:28 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#4</guid>
<category>DisplayFusion</category>
<description><![CDATA[1) Yep, you can add in this line right after line 27: Code
Copy
Select All
BFS.Audio.SetDefaultPlaybackCommunications("DeviceNameHere");
2) I can't think of a great way to do this. We don't have an event to fire off an audio device change, so you would need a script that runs in the backgroun...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
1) Yep, you can add in this line right after line 27: <div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code019e02211095705c9e6ea2481672f103" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019e02211095705c9e6ea2481672f103Js'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code019e02211095705c9e6ea2481672f103Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">BFS.Audio.SetDefaultPlaybackCommunications("DeviceNameHere");</pre><textarea id="code019e02211095705c9e6ea2481672f103" name="code019e02211095705c9e6ea2481672f103" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
2) I can't think of a great way to do this. We don't have an event to fire off an audio device change, so you would need a script that runs in the background and constantly checks to see if the device matches. You might be better off creating a script with a single line that changes the audio device, and add a key combination to manually fire it when you disconnect your device.<br/>
<br/>
Thanks!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Custom Script for Changing audio devices only when A headset is disconnected</title>
<link>https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#3</link>
<pubDate>Tue, 20 Dec 2022 19:02:19 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#3</guid>
<category>DisplayFusion</category>
<description><![CDATA[Hey, Thanks for this! It works great! I have a few additional requests now that I have used it, let me know if this is possible.
1. Can I also have it default the communications device as well as the playback device?
2. If I disconnect my headphones, it goes back to the most recent default devi...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Hey, Thanks for this! It works great! I have a few additional requests now that I have used it, let me know if this is possible.<br/>
<br/>
1. Can I also have it default the communications device as well as the playback device?<br/>
2. If I disconnect my headphones, it goes back to the most recent default device. Is there a way for it to go back to the right default device based on which display configuration I may be on? <br/>
For instace: If I am on Monitor Profile 1 and switch to Profile 2 with my headphones connected, it keeps them connected no problem. That works great! If I turn off the headphones while connected to monitor profile 2 though, It will revert the default to the device used with the previous used profile.<br/>
<br/>
Thank you for your help!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Custom Script for Changing audio devices only when A headset is disconnected</title>
<link>https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#2</link>
<pubDate>Tue, 13 Dec 2022 16:42:48 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d#2</guid>
<category>DisplayFusion</category>
<description><![CDATA[I've attached a script below that should do this for you. You can import it via the DisplayFusion Settings  Functions  Import Scripted Function.
You can set the name of your bluetooth headphones on line 15, and set the name of the audio device you want it changed to if those headphones aren't co...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I've attached a script below that should do this for you. You can import it via the DisplayFusion Settings > Functions > Import Scripted Function.<br/>
<br/>
You can set the name of your bluetooth headphones on line 15, and set the name of the audio device you want it changed to if those headphones aren't connected on line 27. You can then create a trigger that uses the "Monitor Profile Changed" event, and add this script into the actions pane. You can create multiple copies of the script changing to different devices if you would like, depending on which monitor profile you want loaded.<br/>
<br/>
Hope that helps!
</div>
]]></content:encoded>
</item>
<item>
<title>Custom Script for Changing audio devices only when A headset is disconnected</title>
<link>https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d</link>
<pubDate>Mon, 12 Dec 2022 21:42:05 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/custom-script-for-changing-audio-devices-only-when-a-headset-is-disconnected/?ID=129329ae-3816-4496-b6d5-3b6878a0ed7d</guid>
<category>DisplayFusion</category>
<description><![CDATA[Hello,
Is there a custom script someone can provide me to use with triggers, if possible? I am looking to utlize triggers to Change my audio device when my monitor profile changes. But, I want them to only change if a audio device is disconnected.  Essentially, If my Bluetooth Headphones are con...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Hello,<br/>
Is there a custom script someone can provide me to use with triggers, if possible? I am looking to utlize triggers to Change my audio device when my monitor profile changes. But, I want them to only change if a audio device is disconnected.  Essentially, If my Bluetooth Headphones are connected, I dont want any Audio device changes. If they are disconnected, I want an audio device selected as default audio source dependent on which profile it has loaded.<br/>
<br/>
I would also like a trigger if possible to run when the device is disconnected. <br/>
<br/>
Let me know if someone can help provide this or if this may not be possible. Thank you!
</div>
]]></content:encoded>
</item>
</channel>
</rss>