gr4z Posted March 21, 2013 Posted March 21, 2013 I have an old v1 extension that I used to get feedback on the London Tube network. It ran a script and outputted to Growl. Its very useful for getting an up to date status of the network. I am trying to convert it into v2 workflow and have managed to output the text to notification centre, however, the code only shows 2 lines. How do I convert this to show all subway lines in the alfred window and not in notification centre? Script is here (sorry I copied it from a web site somewhere and have lost the original creators address) RESULT=$(curl -s "http://api.tubeupdates.com/?method=get.status&lines=all&format=xml" | cat | awk '/<status>/') for index in Bakerloo Central Circle District DLR Jubilee Metropolitan Northern Piccadilly Victoria Waterloo do RESULT=$(echo $RESULT | sed "s/<status>/$index: /1" | sed "s/<\/status> /\\\n/g" | sed "s/<\/status>//g") done echo -e -n $RESULT Thanks gr4z
Tyler Eich Posted March 21, 2013 Posted March 21, 2013 I have an old v1 extension that I used to get feedback on the London Tube network. It ran a script and outputted to Growl. Its very useful for getting an up to date status of the network. I am trying to convert it into v2 workflow and have managed to output the text to notification centre, however, the code only shows 2 lines. How do I convert this to show all subway lines in the alfred window and not in notification centre? Script is here (sorry I copied it from a web site somewhere and have lost the original creators address) RESULT=$(curl -s "http://api.tubeupdates.com/?method=get.status&lines=all&format=xml" | cat | awk '/<status>/') for index in Bakerloo Central Circle District DLR Jubilee Metropolitan Northern Piccadilly Victoria Waterloo do RESULT=$(echo $RESULT | sed "s/<status>/$index: /1" | sed "s/<\/status> /\\\n/g" | sed "s/<\/status>//g") done echo -e -n $RESULT Thanks gr4z To show more than two lines of output, it seems you must set the 'Notification' object to use Growl. You can use a script filter to feed results back into Alfred.
gr4z Posted March 21, 2013 Author Posted March 21, 2013 (edited) I have changed the Notification to Growl but it makes no difference. Sorry I am not sure what to do when using a Script Filter - can you be a bit more descriptive as to what to do? Thanks Edited March 21, 2013 by gr4z
Tyler Eich Posted March 21, 2013 Posted March 21, 2013 I have changed the Notification to Growl but it makes no difference. Sorry I am not sure what to do when using a Script Filter - can you be a bit more descriptive as to what to do? Thanks To use a script filter, you echo an XML string with the necessary feedback items. This post (http://www.alfredforum.com/topic/5-generating-feedback-in-workflows/) by David Ferguson explains it better than I could. As for Growl, have you set it to use Notification Center? If you have, it will not workproperly
jdfwarrior Posted March 21, 2013 Posted March 21, 2013 I have changed the Notification to Growl but it makes no difference. Sorry I am not sure what to do when using a Script Filter - can you be a bit more descriptive as to what to do? Thanks I haz a gift Download I don't know a full list of all the potential status messages yet. I sent the guy who made the API an email requesting that list. When I get that, I'll update this workflow again. Until then, if there are messages I haven't accounted for yet, the icon will show as a question mark. adamtheturtle, gr4z and Tyler Eich 3
adamtheturtle Posted May 6, 2013 Posted May 6, 2013 I just moved to Alfred 2, and wanted to convert my old extensions to workflows (where appropriate). Looks like I've been beaten to it (and with less hacky code), good work David
archienorman11 Posted February 24, 2014 Posted February 24, 2014 Does anyone know if this workflow still works - I cannot seem to get it working. Thanks in advance.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now