As long as your trying to replicate something done in the command line, you’ll need to use the system command interface. Or you’d need to look into how to do system calls from within javascript.
If it’s done from within the javascript environment, then you’d use a user script function.
I really don’t know the answer to that. Was just trying to show one way of working. Think @holroy has given the info you need (way beyond what I understand).
Good luck. Hope it warms up in Berlin (if that’s where you are).
Hi @spree1 , I just would like to point out some issues.
First of all if you’re using an ordinary template invocation, you’ll get the weather at the time of invocation, and it’ll not update after the first run. If that’s what you want, go for it.
If you want it to update I see two viable options, either use the dynamic template invocation, which would look something like:
<%+ tp.user.weatherNow(tp) %>
This, with the correct corresponding user function would update each time you switch to reading view.
It could possibly be wise to allow the user function to take another parameter, like the town/place you want the weather from.
The alternate method to keep updating the weather both in live preview and reading would be to use dataviewjs in accordance with the call provided by @AlanG , you could do something like:
So it kind of comes down to whether you want the weather report just once, or repeated updates, and whether you want it in live preview and/or reading view.
Thanks for the input! Works fantastic. I just played around a little bit with URL to get the output format I wanted!
@holroy you’re absolutely right and also want the insert the weather at the point of template invocation, in order to have some kind of history within my daily notes
I was thinking more along the lines of having notes for various places which peak my interest somehow, and then have such a snippet to describe the weather there just now.