You are viewing a single comment's thread from:

RE: Tutorial: How to Display the STEEM & Bitcoin price in your MacBook Touch Bar

in #life7 years ago (edited)

That's awsome. Thank's for sharing. As already mentioned it's horrible to see that all day, so I put mine a group. :)

In addition to Charlys great work I wondered how to add cryptos like dash or pivx and created the following script:

on replace_chars(this_text, search_string, replacement_string)
if this_text contains the search_string then
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
end if
return this_text
end replace_chars
set stockValue to do shell script "curl -s 'https://api.coinmarketcap.com/v1/ticker/dash/' | grep 'price_usd'"
set stockValue to replace_chars(stockValue, " "price_usd": "", "")
set stockValue to replace_chars(stockValue, "", ", "")
return "" & "$" & stockValue

Hope it help's. :)

Sort:  

Awesome! Had to do some tweaking on the code though, since Steem seems not to work well for code syntax. Here's a raw txt version of the script for BTC ticker: