<?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: Change audio devices by wildcard string (more than 1 device)</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=6fc22687-1ff0-497d-98e0-ed235faec2ba" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=6fc22687-1ff0-497d-98e0-ed235faec2ba</link>
<description>DisplayFusion RSS: Change audio devices by wildcard string (more than 1 device)</description>
<lastBuildDate>Mon, 20 Apr 2026 01:57:00 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=6fc22687-1ff0-497d-98e0-ed235faec2ba</generator>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#11</link>
<pubDate>Tue, 28 Feb 2017 15:30:11 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#11</guid>
<category>DisplayFusion</category>
<description><![CDATA[I've added this Scripted Function to the repository]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I've added this Scripted Function to the repository <img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/face-smile.light.svg" alt=":)" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:16px;height:16px;" HelpButtonData=":)" HelpButtonDataAlign="BelowMiddle" />
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#10</link>
<pubDate>Tue, 28 Feb 2017 04:41:14 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#10</guid>
<category>DisplayFusion</category>
<description><![CDATA[Quote:
That's odd! You shouldn't need to put the full names of the devices. You just need to make sure that the names are different enough so that one of your items in the array doesn't match both of the audio devices you are trying to switch between. Could this be your problem?
This script doe...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
<div class="BackGrey"><div class="Text"><div><b>Quote:</b></div>That's odd! You shouldn't need to put the full names of the devices. You just need to make sure that the names are different enough so that one of your items in the array doesn't match both of the audio devices you are trying to switch between. Could this be your problem?<br/>
<br/>
This script doesn't use the contains method, but it uses a similar method called 'IndexOf' that does the same thing. I changed it to use this method because I wanted to ignore the casing. Ie. "headset" will now match "Headset", but it didn't before.<br/>
<br/>
I hope this helps!</div></div><br/>
<br/>
Awesome looks like I had a typo....and I am a VBS programmer lol.  Working now.  Thank you for the excellent work.  Anyway we can post this to the actual scripts area for other users?
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#9</link>
<pubDate>Mon, 27 Feb 2017 13:39:52 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#9</guid>
<category>DisplayFusion</category>
<description><![CDATA[That's odd! You shouldn't need to put the full names of the devices. You just need to make sure that the names are different enough so that one of your items in the array doesn't match both of the audio devices you are trying to switch between. Could this be your problem?
This script doesn't use...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
That's odd! You shouldn't need to put the full names of the devices. You just need to make sure that the names are different enough so that one of your items in the array doesn't match both of the audio devices you are trying to switch between. Could this be your problem?<br/>
<br/>
This script doesn't use the contains method, but it uses a similar method called 'IndexOf' that does the same thing. I changed it to use this method because I wanted to ignore the casing. Ie. "headset" will now match "Headset", but it didn't before.<br/>
<br/>
I hope this helps!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#8</link>
<pubDate>Thu, 23 Feb 2017 22:34:03 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#8</guid>
<category>DisplayFusion</category>
<description><![CDATA[So this didn't work.  Mind you, I am not putting the full name of my devices in the audio devices field.  Because the original script didn't require that.  Does this require it?
The old script had a section like this
Code
Copy
Select All
string[] audioDevices = BFS.Audio.GetPlaybackDevices()...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
So this didn't work.  Mind you, I am not putting the full name of my devices in the audio devices field.  Because the original script didn't require that.  Does this require it?<br/>
<br/>
The old script had a section like this<br/>
<br/>
<div id="" 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="#code019da89af522758f81f3e6f0a4f2a25e" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019da89af522758f81f3e6f0a4f2a25eJs'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;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="code019da89af522758f81f3e6f0a4f2a25eJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">string[] audioDevices = BFS.Audio.GetPlaybackDevices();
foreach (string device in audioDevices)
{
if (device.Contains("SAMSUNG"))
BFS.Audio.SetDefaultPlaybackSounds(device);
}</pre><textarea id="code019da89af522758f81f3e6f0a4f2a25e" name="code019da89af522758f81f3e6f0a4f2a25e" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
I don't see a "contains" section in your code
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#7</link>
<pubDate>Thu, 23 Feb 2017 22:21:40 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#7</guid>
<category>DisplayFusion</category>
<description><![CDATA[Quote:
Sorry for the delay! I attached a script that should work for you in this post. Here's how to get it to work:
Download the file attached to this post
Open the DisplayFusion Settings window to the "Functions" tab
Click the "Add Scripted" button
In the window that pops up, paste the cod...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
<div class="BackGrey"><div class="Text"><div><b>Quote:</b></div>Sorry for the delay! I attached a script that should work for you in this post. Here's how to get it to work:<br/>
<br/>
<ul class="ListBullet">
<li>Download the file attached to this post</li>
<li>Open the DisplayFusion Settings window to the "Functions" tab</li>
<li>Click the "Add Scripted" button</li>
<li>In the window that pops up, paste the code from the file you downloaded in the first step</li>
<li>Change the two strings on line 17 to something that will match the names of your audio devices</li>
<li>Give the script a name, and a key combination if you want</li>
<li>Click OK to save and close that window, then OK again to save and apply your settings</li></ul>
<br/>
I hope this works for you!</div></div><br/>
<br/>
Thank you very much!  I'll give this a shot in a few!!  Can we make this an official script?  This is by far the easiest method to switch between audio devices.
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#6</link>
<pubDate>Thu, 23 Feb 2017 22:20:14 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#6</guid>
<category>DisplayFusion</category>
<description><![CDATA[Sorry for the delay! I attached a script that should work for you in this post. Here's how to get it to work:
Download the file attached to this post
Open the DisplayFusion Settings window to the "Functions" tab
Click the "Add Scripted" button
In the window that pops up, paste the code from t...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Sorry for the delay! I attached a script that should work for you in this post. Here's how to get it to work:<br/>
<br/>
<ul class="ListBullet">
<li>Download the file attached to this post</li>
<li>Open the DisplayFusion Settings window to the "Functions" tab</li>
<li>Click the "Add Scripted" button</li>
<li>In the window that pops up, paste the code from the file you downloaded in the first step</li>
<li>Change the two strings on line 17 to something that will match the names of your audio devices</li>
<li>Give the script a name, and a key combination if you want</li>
<li>Click OK to save and close that window, then OK again to save and apply your settings</li></ul>
<br/>
I hope this works for you!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#5</link>
<pubDate>Sat, 18 Feb 2017 07:51:47 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#5</guid>
<category>DisplayFusion</category>
<description><![CDATA[Bump, any status changes?  I can write the code if you can put me in the right direction.]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Bump, any status changes?  I can write the code if you can put me in the right direction.
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#4</link>
<pubDate>Wed, 15 Feb 2017 17:09:15 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#4</guid>
<category>DisplayFusion</category>
<description><![CDATA[Quote:
We should be able to write a script that does what you're looking for. We'll post it when it's ready
Thank you very much, I can write code fine in VBS but C# I cannot figure out!]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
<div class="BackGrey"><div class="Text"><div><b>Quote:</b></div>We should be able to write a script that does what you're looking for. We'll post it when it's ready <img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/face-smile.light.svg" alt=":)" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:16px;height:16px;" HelpButtonData=":)" HelpButtonDataAlign="BelowMiddle" /></div></div><br/>
<br/>
Thank you very much, I can write code fine in VBS but C# I cannot figure out!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#3</link>
<pubDate>Tue, 14 Feb 2017 19:09:11 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#3</guid>
<category>DisplayFusion</category>
<description><![CDATA[We should be able to write a script that does what you're looking for. We'll post it when it's ready]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
We should be able to write a script that does what you're looking for. We'll post it when it's ready <img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/face-smile.light.svg" alt=":)" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:16px;height:16px;" HelpButtonData=":)" HelpButtonDataAlign="BelowMiddle" />
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#2</link>
<pubDate>Tue, 14 Feb 2017 17:11:45 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba#2</guid>
<category>DisplayFusion</category>
<description><![CDATA[bump]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
bump
</div>
]]></content:encoded>
</item>
<item>
<title>Change audio devices by wildcard string (more than 1 device)</title>
<link>https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba</link>
<pubDate>Mon, 13 Feb 2017 02:20:03 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/change-audio-devices-by-wildcard-string-more-than-1-device/?ID=6fc22687-1ff0-497d-98e0-ed235faec2ba</guid>
<category>DisplayFusion</category>
<description><![CDATA[HELLO!
I know about the script that is made to switch to an audio device with a dynamic name.
Code
Copy
Select All
using System;
using System.Drawing;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
string[] audioDevices = BFS.Audio.GetPlayback...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
HELLO!<br/>
<br/>
I know about the script that is made to switch to an audio device with a dynamic name.<br/>
<br/>
<div id="" 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="#code019da89af54772f184a296589df90928" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019da89af54772f184a296589df90928Js'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;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="code019da89af54772f184a296589df90928Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Drawing;

public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
string[] audioDevices = BFS.Audio.GetPlaybackDevices();
foreach (string device in audioDevices)
{
if (device.Contains("SAMSUNG"))
BFS.Audio.SetDefaultPlaybackSounds(device);
}
}
}</pre><textarea id="code019da89af54772f184a296589df90928" name="code019da89af54772f184a296589df90928" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
But what if I have 2 audio devices with dynamic names that I want to switch through?  How would I set that up?  There are 2 scripts here on the forums that are perfect if they were combined.  One script switches between devices with exact file names and the other switches to a device based on a wild card but not multiple.  I need a combination of both.  <br/>
<br/>
Basically<br/>
<br/>
If audio device contains "blah" but is NOT "blah" then switch to "blah"<br/>
Else switch to "blah2"<br/>
<br/>
Thanks in advance!
</div>
]]></content:encoded>
</item>
</channel>
</rss>