Jump to content

Help getting first workflow working: basic shell script


Recommended Posts

I'm trying to create a workflow that will allow me to easily toggle between output devices. I've found a command-line utility for that, so I've just got to write a little script for it to work in Alfred with a keyword.

 

This script works if I run it from terminal in a separate file, but when I run the workflow, nothing happens. How can I get feedback from this script to help me debug, and is there any reason why it might work in terminal but not in Alfred?

external_output="Oliver's AirPort Express"

if audiodevice | grep "AirPort Express"
then
  audiodevice output "Internal Speakers"
else
  audiodevice output "$external_output"
fi
Link to comment
  • 2 weeks later...

It's been discussed, adding some kind of debugging ability into Alfred but a decision hasn't been made.

 

Dave, have you tried checking Console.app to see if there is any kind of error output from there? Also, if you would like, I can look at the code for you as well and see if I can help you figure out the issue

Link to comment

You want to know my dirty little debugging trick I use for shell scripts? I drop in Growl notifications (via growlnotify) when I want to check that the script is going where I want it to (following the right "if" options, etc.) with the variables assigned as expected. I'm sure seasoned programmers would look down their noses at such nonsense, but it works for me, for now. B)

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...