Jump to content

easy to switch input or output audio


Recommended Posts

11 minutes ago, chris said:

How is this different than @mikegrb's Audio Device Workflow?


I took a look, and the underlying scheme used is the same.

 

But I did something different, for example, I will prompt the currently selected audio.

 

 

At the same time, I consider supporting AirPlay device support, of course it is not yet supported.

 

Edited by Alan He
Link to comment

Got it. And you're using Node and not Perl.

 

I personalized the keywords to "output" and "input" (based on my muscle memory with the previous Workflow) and adjusted the text of the notifications to be a little clearer:

 

Audio could not be switched to {var:device}

Audio switched to {var:device}

 

image.thumb.png.209b2cf3207460946d41afc5bef43343.png

 

Thanks for sharing!

Link to comment

@Alan He I tweaked index.js to add some context to each option (the line `title: "Switch to " + item,`), but I'm getting an empty row as a result. Any idea why? 

 

console.log(
  JSON.stringify({
    items: audios
      .map((item) => item.replace(/(^(\n|\s)|(\n|\s)$)/g, ''))
      .map((item) => ({
        title: "Switch to " + item,
        arg: item,
        subtitle: item === currentDeviceRes ? 'selected' : ''
      }))
  })
);

 

99041732_CleanShot2020-12-06at19_38.03@2x.thumb.png.33f3dbf7ea9fa1f22b1faa106622a377.png

Link to comment
21 minutes ago, chris said:

@Alan He I tweaked index.js to add some context to each option (the line `title: "Switch to " + item,`), but I'm getting an empty row as a result. Any idea why? 

 


console.log(
  JSON.stringify({
    items: audios
      .map((item) => item.replace(/(^(\n|\s)|(\n|\s)$)/g, ''))
      .map((item) => ({
        title: "Switch to " + item,
        arg: item,
        subtitle: item === currentDeviceRes ? 'selected' : ''
      }))
  })
);

 

99041732_CleanShot2020-12-06at19_38.03@2x.thumb.png.33f3dbf7ea9fa1f22b1faa106622a377.png

 

some code missing cause code bug.

 

I have update workflow, please update it.

Thank you.

 

I accepted your suggestion and revised the item's description.

 

image.png.d358d4e44bbc6d80b4584ff53b69a47a.png

 

 

Link to comment
  • 1 month later...
  • 3 weeks later...
On 1/14/2021 at 8:19 PM, SJ2K said:

This workflow doesn't seem to detect AirPods as a valid output option (even though they appear in the Sound preference pane)

That's true at the time, I'm thinking about updating it, but this needs to be investigated.

Link to comment
  • 2 weeks later...
  • 1 year later...
  • 1 month later...

Hello all, 

I always get the following error message:
Scripts/9E568110-B58A-4AA5-B52E-B8D6B174F1E9:212:248: execution error: "System Events" received an error: osascript does not have permission for helper access. (-25211)

 

Can someone tell me how to fix this error? 

 

Under Automation: osascript and Alfred are checked
Also under accessibility: Automator, Terminal and Alfred.

Thanks!

Link to comment
  • 4 months later...
  • 2 weeks later...

Hi,

 

Thank you for the nice work here.

 

I have the same issue as:

Quote

Hi, just installed this workflow but when y type sound it just says: "waiting" and then just disappear and the only option is system preferences one.

 

The console reads:

[11:17:27.008] Switch Audio[Script Filter] Queuing argument '(null)'

 

I did reset permissions, to no avail.

 

Thank you for your assistance.

 

 

Link to comment
On 10/20/2022 at 12:26 PM, lwg said:

Hi,

 

Thank you for the nice work here.

 

I have the same issue as:

 

The console reads:

[11:17:27.008] Switch Audio[Script Filter] Queuing argument '(null)'

 

I did reset permissions, to no avail.

 

Thank you for your assistance.

 

 

started happening after upgrade to macOS 13 today.

the output in debugger:
 

[16:28:00.276] Switch Audio[Script Filter] Queuing argument '(null)'
[16:28:00.459] Switch Audio[Script Filter] Script with argv '(null)' finished
[16:28:00.464] ERROR: Switch Audio[Script Filter] Code 1: /Users/alexbnd/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/E7A7EAD6-47A0-4D0E-A33B-93BD538DDB30:55:102: execution error: System Settings got an error: AppleEvent handler failed. (-10000)

 

Edited by abEnigma
Link to comment

That’s because it tries to automate the System Preferences app, which is now System Settings which has poor AppleScript support.

 

It’s helpful if you use the Feedback Assistant app and let Apple know you want AppleScript support in System Settings. The more people do it, the higher the chance it’ll be implemented.

Link to comment
On 10/20/2022 at 11:26 AM, lwg said:

Hi,

 

Thank you for the nice work here.

 

I have the same issue as:

 

The console reads:

[11:17:27.008] Switch Audio[Script Filter] Queuing argument '(null)'

 

I did reset permissions, to no avail.

 

Thank you for your assistance.

 

 

 

I am not on Ventura by the way, but Monterey.

Link to comment

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
×
×
  • Create New...