Jump to content

[Request] AirPlay


Recommended Posts

iTunes was recently updated to allow control of AirPlay video AppleScript. I was wondering if someone could make a workflow for it?

 

Here's a small example script:

tell application "iTunes"
	set apNames to (get name of AirPlay devices)
	set apDevices to (get AirPlay devices)
	set rez to choose from list apNames with prompt "Select Airplay:" with multiple selections allowed
	if rez is false then return
	set apPlays to {}
	repeat with i from 1 to length of apNames
		if item i of apNames is in rez then set end of apPlays to item i of apDevices
	end repeat
	set current AirPlay devices to apPlays
end tell
Link to comment
  • 4 weeks later...
  • 2 months later...
  • 4 months later...

I thought I'd post an update to let anyone following this thread know: I uploaded the most recent version of this workflow to the new Packal site, here. It sounds like there will be a great feature over there to keep track of updated workflows so you may want to keep an eye out.

 

There have not been any updates since September so you won't miss anything if you don't grab the version over there.  B) 

Link to comment
  • 2 months later...

Just a minor update to this workflow: It seems like the Airplay device results were not being ordered properly (possibly due to tiny a change in Alfred after the 2.2 update).

 

I pushed a 1.01 update to Packal; you can grab the new version there.

Link to comment
  • 11 months later...

Thanks for this.  I've added a couple Remote Triggers - you set up a trigger with the Argument type Text and the string as the name of the desired Airplay device, then pipe it out to the existing script in the workflow.  Works great.

Link to comment

Thanks for this.  I've added a couple Remote Triggers - you set up a trigger with the Argument type Text and the string as the name of the desired Airplay device, then pipe it out to the existing script in the workflow.  Works great.

That's a great idea. I was waiting patiently for the day when maybe the remote app is able to auto-populate triggers within itself, but if this is fairly easy I could add a few blank triggers to the workflow and provide examples for anyone that wants them.

 

I'll probably mess around today and add that as a minor update.

Link to comment
  • 6 months later...

Smirky - awesome app and thank you for posting it.  One wish list item for you to consider if you get back to working on this app:

  • Would it be possible to edit your script to allow multiple devices to be selected as opposed to just one at a time?  I sometimes want to pipe music to several rooms in my house at once and this would be a great addition.

And then one tip for anyone else trying to automate some of this via remote.  The first way I did it was to add a remote page that triggers this workflow, and then a series of other "Dispatch Key Combo" buttons that send the CMD 1, CMD 2, CMD 3, etc. shortcuts that each select one of the AirPlay devices in my house.  This allows you to automated doing it remotely, though it's still only selecting one speaker at a time for now.

 

Thanks again, great script!

 

 

Link to comment
  • 4 years later...

Does this workflow still work?

I entered a hotkey, but "iTunes Airplay  Toggle" flashes in the Alfred search bar and disappears.

Am I doing something wrong?

 

I just need a way to select various AirPlay speakers. Is there a better way?

Edited by mlondon
Link to comment
On 4/9/2020 at 9:26 AM, mlondon said:

Does this workflow still work?

 

Hi, yes! I still maintain this workflow as regularly as possible via the github page linked below. The current version works with Catalina but you can grab an older version if you haven't upgraded yet. Let me know if you're having any trouble with the current version and I'll help fix anything needed.

 

https://github.com/dotson/iTunes-Airplay-Toggle

Link to comment
On 4/10/2020 at 9:39 PM, smirky said:

Hi, yes! I still maintain this workflow as regularly as possible via the github page linked below. The current version works with Catalina but you can grab an older version if you haven't upgraded yet. Let me know if you're having any trouble with the current version and I'll help fix anything needed.

 

Hi, Got it working on Mojave, thank you.

However I see that the workflow just toggles each Airplay target on/off.

I would like to be able to SWITCH from one to another.

For example, iTunes is set to play to Computer. Using your workflow, I have to toggle Computer OFF, and then toggle my speakers ON.

Is there a way to SWITCH instead of the current behaviour?

 

Thanks again...

Link to comment
6 hours ago, mlondon said:

 

Hi, Got it working on Mojave, thank you.

However I see that the workflow just toggles each Airplay target on/off.

I would like to be able to SWITCH from one to another.

For example, iTunes is set to play to Computer. Using your workflow, I have to toggle Computer OFF, and then toggle my speakers ON.

Is there a way to SWITCH instead of the current behaviour?

 

Thanks again...

 

Thanks for the update, glad to hear that it's working for you!

 

That feature should be fairly simple to implement and there are a couple ways to go about doing it. One is to allow a key option such that using it would toggle all choices rather than the one specifically chosen (i.e., action using shift-enter to make this one active and the others inactive). This would allow both the existing function and additional function to exist all at once. Another would be to let the user set which is the default type of action (i.e., set the variable in the preferences).

 

I think it'd be possible to do both at once, so you could tell Alfred which choice is your preferred default ('individual toggle' or 'switch to') and then have the other option be chosen with the special key combo. I'm going to play around a bit and see if I can make that work.

Link to comment
  • 2 weeks later...
On 4/20/2020 at 10:47 AM, mlondon said:

 

Hi, Got it working on Mojave, thank you.

However I see that the workflow just toggles each Airplay target on/off.

I would like to be able to SWITCH from one to another.

For example, iTunes is set to play to Computer. Using your workflow, I have to toggle Computer OFF, and then toggle my speakers ON.

Is there a way to SWITCH instead of the current behaviour?

 

Thanks again...

Just pushed an update based on your request. Give it a shot and let me know if it works for you. You'll just need to change the default behavior from "toggle" to "select" in the variables section, per the About This Workflow page in Alfred. Please let me know if you have any issues or other ideas on improvements!

 

https://github.com/dotson/iTunes-Airplay-Toggle

Link to comment
3 hours ago, smirky said:

Just pushed an update based on your request. Give it a shot and let me know if it works for you. You'll just need to change the default behavior from "toggle" to "select" in the variables section, per the About This Workflow page in Alfred. Please let me know if you have any issues or other ideas on improvements!

 

https://github.com/dotson/iTunes-Airplay-Toggle

 

Really appreciate this!

However, now when I trigger the workflow, it tries to open Parallels app (for Windoze emulation).

I have zero idea why this is happening. Doesnt matter what I change your workflow hotkey to, still invokes Parallels

None of my AirPlay devices are connected to Windoze in any way. 

Very strange.... 

Link to comment
35 minutes ago, mlondon said:

 

Really appreciate this!

However, now when I trigger the workflow, it tries to open Parallels app (for Windoze emulation).

I have zero idea why this is happening. Doesnt matter what I change your workflow hotkey to, still invokes Parallels

None of my AirPlay devices are connected to Windoze in any way. 

Very strange.... 

 

Well that’s super weird, sorry about that! Does the workflow work as expected but also triggers Parallels or does it not work at all plus Parallels opens up unexpectedly?

 

Can you post the output from Alfred’s debug window after you run the workflow? What’s your Mac OS and Parallels version? I’ll see if I can mirror those and replicate this locally to sort it out.

Link to comment
  • 2 years later...

Hi @smirky

Workflow is working fine (I deleted Parallels)

However, I would like to trigger it using an Alfred Keyword instead of the function key.

I added a keyword trigger, but its not working.

Is this possible? How should I configure the keyword trigger (I'm not an Alfred expert)

 

Thank you,

Matthew

 

 

Link to comment
22 hours ago, mlondon said:

However, I would like to trigger it using an Alfred Keyword instead of the function key.

I added a keyword trigger, but its not working.

Hi Matthew!

 

The simplest way for now would be to add your keyword to the first Script Filter action, see the two screenshots below.

 

A better long term solution would be for me to add the keyword trigger and allow the user to customize it in the settings so that it stays after future updates. I might be able to work on that this weekend. Until then, the solution in the screenshots should do what you need just fine.

 

Let me know if you have any questions!

Screen Shot 2023-04-21 at 7.00.53 AM.png

Screen Shot 2023-04-21 at 7.00.29 AM.png

Link to comment
On 4/20/2023 at 8:21 AM, mlondon said:

Hi @smirky

Workflow is working fine (I deleted Parallels)

However, I would like to trigger it using an Alfred Keyword instead of the function key.

I added a keyword trigger, but its not working.

Is this possible? How should I configure the keyword trigger (I'm not an Alfred expert)

 

Thank you,

Matthew

 

 

Just posted an update to this workflow that gives you a keyword option in the workflow configuration page. This update should get pushed to your device via OneUpdater or you can grab it direct from Github. Let me know if you run into any issues!

 

https://github.com/dotson/iTunes-Airplay-Toggle

Screen Shot 2023-04-23 at 12.48.26 PM.png

Link to comment
  • 5 weeks later...
7 hours ago, vitor said:

@smirky Would you like to submit this for the Gallery?

Thanks Vitor, that would be cool. I don't have a retina display available so I generally avoided the idea of submitting my workflows. If someone was able to share a screenshot or two, I could add them to the ReadMe and make the update in #1 above all in one shot.

 

Should I create a new thread in the other subforum for ease of tracking this? I'm happy to do that as well.

Link to comment
On 5/24/2023 at 2:11 AM, smirky said:

Should I create a new thread in the other subforum for ease of tracking this? I'm happy to do that as well.

 

Yes, please. Do so after making a new release removing auto-updating and I’ll get on with adding it.

 

On 5/24/2023 at 2:11 AM, smirky said:

I don't have a retina display available so I generally avoided the idea of submitting my workflows.

 

That’s alright. As the post says: “If you don’t have a retina screen, let us know”. Don’t worry about that part, I’ll reproduce it. But please do submit screenshots for future submissions, even if not retina, because it helps with determining what’s the desired behaviour of the workflow.

 

By the way, would it be a good time to change the name of the workflow to “Music Airplay Toggle”? It doesn’t have to change, but it occurred to me as a possibility.

 

Edited by vitor
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...