I can't change a custom action to script


#1

When I first started using the tools I could set a script. However now I just get the option of custom URL. How do I change on these to be a script?


#2

Although they said Custom Script to begin with I could never get it to register a script. Oh to be able to configure it to run a terminal command!


#3

I just haven’t finished building that action yet. I have not yet decided whether it should be a file chooser to run a script, or a text box to run a script directly.


#4

Ok, I built both. Will be released shortly.


#5

Awesome! Looking forward to it


#6

This shipped, let me know how it works for you. I’d also love to know what you’re controlling with the custom script.


#7

Just tried this out myself. Embedded scripts (“Run script”) seem to work OK but when I put an executable shell script in “Execute file” it just opens it in an editor rather than executing it. I worked around this by executing my shell script indirectly from an embedded script instead.

What I’m using it for currently is switching audio output to/from AirPlay in iTunes, so I can leave the Turn Touch in my living room with the AirPlay receiver whereas my Mac mini is in my office.

This is a more generic suggestion but it’d sure be nice to be able to rename the button labels! I can only keep so much in my head and “Trigger action” (for IFTTT) or “Run script” can be a bit ambiguous when there’s more than one of them.


#8

What’s the script contents for switching audio for airplay? I would love to feature this somewhere since it seems like a useful command. I might just bake it into the app.


#9

And custom labels has been requested numerous times. I guess it’s time to build it in.


#10

Ok, you can now rename all button labels. I submitted the app to the TestFlight review, so that should take a day to be approved. But the Mac app is out right now.


#11

Here’s a script to switch iTunes audio to AirPlay and back. Unfortunately switching system audio to/from AirPlay lost any documented interface a few macOS versions ago (it used to just show up like any other audio destination and even be targetable on a per-app basis, now it doesn’t).

#!/usr/bin/osascript

local _wasPlaying

tell application "iTunes"
	set _wasPlaying to player state is playing
	if _wasPlaying then pause -- work around iTunes bug, can hang indefinitely if playing
	set current AirPlay devices to {AirPlay device "Living Room"}
	if _wasPlaying then play
end tell

And vice versa (I’ve got this as part of a larger script so it’s a bit differently formatted):

osascript -e 'tell application "iTunes"' \
	-e 'get (AirPlay devices whose kind is computer)' \
	-e 'set current AirPlay devices to the result' \
	-e 'end tell'

#12

Awesome — looks great, also because I don’t have enough actions to go around I can now clean up :slight_smile: