Garevans Posted April 26, 2018 Share Posted April 26, 2018 Hi Everybody! I've been tinkering around with workflows tonight and had trouble finding a working example to show the results of a bash script in the search field. Does anybody have a good clear example I can work from? My current code is very basic: query="{query}" curl -s https://www.marketwatch.com/investing/stock/aapl |grep '<meta name="price" content="' |cut -d'"' -f4 I've been able to export the results to large text / push notification, but I cannot find the option for inline search result (I hope I'm using the correct terminology) Link to comment
vitor Posted April 27, 2018 Share Posted April 27, 2018 Welcome @Garevans For what you want, you need a Script Filter and return either XML or JSON. For example, in your case the first line is unnecessary (unless you just forgot to insert ${query} in your second line, which seems like it can be the case). Add a Script Filter and make this the code: query="${1}" value="$(curl -s https://www.marketwatch.com/investing/stock/${query} |grep '<meta name="price" content="' |cut -d'"' -f4)" cat <<EOF {"items": [ { "title": "${value}", "subtitle": "${query}" } ]} EOF It should work like you want, and require only minor adjustments to your preferences. Garevans 1 Link to comment
Garevans Posted April 27, 2018 Author Share Posted April 27, 2018 @vitor this is perfect thank you, I should be able to adjust that script to tinker accordingly. I also appreciate the (very) swift response Link to comment
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