Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Status
Not open for further replies.
You have to use certain Yahoo urls for this shell script to work the url you need is below. Like I said before, the script is looking for "forecast-icon" before it does the regular expressions, if it cannot find that, the script won't progress further.

Code:
http://weather.yahoo.com/england/greater-london/london-44418/?unit=c

The full shell script for you would be the following:
Code:
curl --silent http://weather.yahoo.com/england/greater-london/london-44418/?unit=c | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /tmp/weather.png

I'm slowly working on an ultimate weather script that will have the option of downloading the weather image. I don't have an ETA on the script though.

Thanks a lot for your help, it's all working perfectly now....Really appreciate it!
 
Actual weather

one question
the image, it is an icon, it doesn't change with actual weather. i.e. if it was sunny and now it is raining it doesn't change the sun image for raining image. Or can it do it? how?
 
You have to use certain Yahoo urls for this shell script to work the url you need is below. Like I said before, the script is looking for "forecast-icon" before it does the regular expressions, if it cannot find that, the script won't progress further.

Code:
http://weather.yahoo.com/england/greater-london/london-44418/?unit=c

The full shell script for you would be the following:
Code:
curl --silent http://weather.yahoo.com/england/greater-london/london-44418/?unit=c | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /tmp/weather.png

I'm slowly working on an ultimate weather script that will have the option of downloading the weather image. I don't have an ETA on the script though.

I also noticed about 10 days ago that my weather image script had stopped working. As I have posted before in this thread, I got mine from CoolEnufForaMac on YouTube and it was great. I was going to ask tonight on this thread if anyone had an updated script and low and behold you have already sorted it for me ! Many thanks. My script had read as below but with my location edited out of course. I had a look at the yahoo site and noticed that they were no longer calling the image "forecast-icon" as searching for the term didn't reveal any hits. I used to know a little UNIX scripting but I confess sed just gives me a head-ache as i now take pain medication which as a side effect causes severe confusion/concentration issues. (I'm going to re-read up on sed and try and learn it again as it is obviously a key scripting component). Anyway your above posted fix works, I'm just posting my old code for reference.

Code:
curl --silent "http://uk.weather.yahoo.com/england/my_location/" | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /tmp/weather.png

I have been following this thread for many months and have seen how you have contributed immensely. I just wanted to say a public thank you. It's all too easy to make use of the help given here and not comment. I'm commenting in the hope that you and others feel appreciated and continue to help us non-expert coders make best use of our machines.

As an aside and i'm happy enough if it isn't possible:

When i first saw the weather scripts and the Yahoo site, I thought it would be ideal for my Father-in-Law to have this on his mac as he is a keen gardener. He has just turned 81, yes 81 but still rises at 05:00 to tend to his plants and garden etc. He has won several Gold Medals at the London RHS Chelsea Flower Show which is the highest achievement any amateur or professional grower can obtain here in the UK.

The scripts provided by CoolEnufForaMac showed the text forecast for the next couple of days but I really wanted to be able to display the images for the forecasts with the corresponding day name as well. At his age it would be much easier just to see the 6 images on the desktop. I wondered A) if this had been done by anone as I have not seen it on this thread and if not, B) if there was anyone out there kind enough to script this for us. Just asking and hoping but still extremely happy with what I've already got.

Once again, thank you.
 
Last edited:
one question
the image, it is an icon, it doesn't change with actual weather. i.e. if it was sunny and now it is raining it doesn't change the sun image for raining image. Or can it do it? how?

You have to have a script running that pulls down the weather image on a set interval; I do all my weather stuff every 15 minutes.

So there are two geeklets:
1 - Weather script that grabs the image from the internets
2 - Image geeklet to display the image pulled in script 1
 
I have been following this thread for many months and have seen how you have contributed immensely. I just wanted to say a public thank you. It's all too easy to make use of the help given here and not comment. I'm commenting in the hope that you and others feel appreciated and continue to help us non-expert coders make best use of our machines.

As an aside and i'm happy enough if it isn't possible:

The scripts provided by CoolEnufForaMac showed the text forecast for the next couple of days but I really wanted to be able to display the images for the forecasts with the corresponding day name as well. At his age it would be much easier just to see the 6 images on the desktop. I wondered A) if this had been done by anone as I have not seen it on this thread and if not, B) if there was anyone out there kind enough to script this for us. Just asking and hoping but still extremely happy with what I've already got.

Thanks SlugBlanket for the kind words. Not going to lie, sed confuses the crap out of me too.

I don't think it would be an issue grabbing the images for each day of the week, the only problem would be the number of geeklets required to display them all. I'll try working this into my ultimate weather script, which, unfortunately, I haven't worked on in a month. I think I may get some time tonight to look at it some more.
 
You have to have a script running that pulls down the weather image on a set interval;

So there are two geeklets:
1 - Weather script that grabs the image from the internets

how do i do it?
I have tried a lot of scripts but none work. tutorials etc... nothing
:confused:
 

Attachments

  • Captura de pantalla 2012-03-21 a la(s) 20.38.47.png
    Captura de pantalla 2012-03-21 a la(s) 20.38.47.png
    1.3 MB · Views: 237
Weather

Have you run the apple script and what happens when you hit compile then run> What shows up at the bottom of the ascreen>

something like this:

"[33;01mToday - Partly Cloudy / High: 80° F Low: 66° F[39;49;00m

[33;01mThu - Partly Cloudy / High: 84° F Low: 65° F[39;49;00m

[33;01mFri - Mostly Sunny / High: 85° F Low: 64° F[39;49;00m

[33;01mSat - Partly Cloudy / High: 85° F Low: 66° F[39;49;00m

[33;01mSun - Scattered Thunderstorms / High: 81° F Low: 59° F[39;49;00m"


Did you make the the 2nd Image geeklet> It might help to post the command in the geeklet it should look like this:

osascript /Users/twosavy/Documents/Forecast.scpt

It has to be a simple error message on the file location command. If you save everything in a new file and use that file for your location, set refresh to 360 plus I don't see a DEFAULT geeklet location in your properties box>

I am far from an expert on this geeklet stufff but i will help you any way that I can.
 

Attachments

  • Screen Shot 2012-03-21 at 6.42.13 PM.png
    Screen Shot 2012-03-21 at 6.42.13 PM.png
    1.3 MB · Views: 175
Last edited:
Thank u VERY MUCH to bluereef who has helped me a lot of to set up the weather script

There is only a thing we couldn't get, and it is the weather in Spanish...
anyone can help me?
 
Latest .556 deals

With ammo prices skyrocketing I decided to make a floating transparent version of this periodically updated png:
223_556_reloadable.png

As you can see its an image file so mining the data is not an option. I decided to use imagemagic to invert the png and make the resulting black background transparent. It will drop the file 223_556_reloadablebk.png
into your /Username/Pictures directory where you can point an image geeklet. This can come in handy for any type of periodically updated png file with an ugly white background you wish to remove.

You will need to install MacPorts, ImageMagick and wget.
After you install MacPorts you can install ImageMagick and wget by typing this into terminal:
Code:
sudo port install ImageMagick
sudo port install wget


Here is the code to grab the png, invert it & make the background transparent:
Code:
#!/bin/bash
cd ~/Pictures/
mv 223_556_reloadable.png 223_556_reloadablebk.png

# Image location http://gun-deals.com/dailyPrices/223_556_reloadable.png
wgetapp=$(which wget)
$wgetapp -c http://gun-deals.com/dailyPrices/223_556_reloadable.png

if [ -e ~/Pictures/223_556_reloadable.png ]
then rm ~/Pictures/223_556_reloadablebk.png
else mv ~/Pictures/223_556_reloadablebk.png ~/Pictures/223_556_reloadable.png
fi

/opt/local/bin/convert ~/Pictures/223_556_reloadable.png -negate -transparent black ~/Pictures/223_556_reloadable.png

exit 0

The result:
 

Attachments

  • 223_556_reloadable.png
    223_556_reloadable.png
    5.1 KB · Views: 160
Hi, I'm wondering wether someone could help me to create a time version of the geeklets on this theme: http://www.macosxtips.co.uk/geeklets/system/system-info-circular-graphics/ that displays the hours out of 12 on one, the minutes on another and the seconds on another as well. Make sure you install the font otherwise it won't work.

Thanks

It's possible and I'm looking into it, but the problem I see is that the font only uses 51 characters. This becomes an issue when trying to figure out what to do for minutes and seconds when you don't have enough characters.
 
I'm a Geektool newbie (just have time/date/weather forecast) - Do any of you happen to know how to get wave conditions and/or tide forecasts to load via geek tool?

http://www.macosxtips.co.uk/geeklets/weather/tide-times/

wave report would be pretty cool - could probably do using the same method but for magic seaweed or somewhere. Only issue would be displaying multiple breaks - might get a bit messy, depending on where you live and how many are nearby!
 
my weather image sometimes blinks, like a car signal light
Why?
If I setup refresh to more than 1 second it dissapears
 

Attachments

  • Captura de pantalla 2012-03-24 a la(s) 14.54.28.png
    Captura de pantalla 2012-03-24 a la(s) 14.54.28.png
    2.3 MB · Views: 208
It's possible and I'm looking into it, but the problem I see is that the font only uses 51 characters. This becomes an issue when trying to figure out what to do for minutes and seconds when you don't have enough characters.

Thanks for your reply. Maybe it would be better for it to update it a bit less and set it to assign a certain character at certain times.
 
It's possible and I'm looking into it, but the problem I see is that the font only uses 51 characters. This becomes an issue when trying to figure out what to do for minutes and seconds when you don't have enough characters.

Also, the "start" point of all the images starts at the 3 o'clock position.
 
It's possible and I'm looking into it, but the problem I see is that the font only uses 51 characters. This becomes an issue when trying to figure out what to do for minutes and seconds when you don't have enough characters.

Well, I broke out Gimp last night and this is what I came up with. There are 24 images ... this allows one to create a 24 clock or a 12 hour clock. The same images can also be used for the minutes and seconds to reflect increments of 2.5 minutes and/or 2.5 seconds.

Here is what is looks likes ...

clock.png


There are 3 separate AppleScripts that control each image.

The outermost ring is the seconds and I have it updating every 2 seconds. The order in which you add the images is important when overlaying the images like I did. Also, the sizing of the images is important when trying to display the clock as I have. It takes some trial and error to properly and evenly size the images.

In this case, I added the seconds first, then the hours, and finally the minutes.
 
Well, I broke out Gimp last night and this is what I came up with. There are 24 images ... this allows one to create a 24 clock or a 12 hour clock. The same images can also be used for the minutes and seconds to reflect increments of 2.5 minutes and/or 2.5 seconds.

Here is what is looks likes ...

Image

There are 3 separate AppleScripts that control each image.

The outermost ring is the seconds and I have it updating every 2 seconds. The order in which you add the images is important when overlaying the images like I did. Also, the sizing of the images is important when trying to display the clock as I have. It takes some trial and error to properly and evenly size the images.

In this case, I added the seconds first, then the hours, and finally the minutes.

Excellent work!

Do you mind posting the images and script so marzomac can setup his desktop? He was the person originally asking.
 
Excellent work!

Do you mind posting the images and script so marzomac can setup his desktop? He was the person originally asking.

Thank you !

Here is my desktop ...

screenshot.png


Here are the goods ... Mind you, most of what you see was already done by someone else, I have just tweaked things to my liking or made changes for efficiency. The only original piece of work is the circular "Clock".

Clock - this is the circular clock

WordOClock

Create a shell geeklet ...

osascript /Users/yourname/GeekTool/WordOClock.scpt

BatteryMeter

DiskMeter

RAMMeter

TrashCan

WeatherIcon

WeatherIcon … I wasn't thrilled with the weather icons that yahoo weather puts out and I know there are many other nice sets out there so I decided to see if I could figure out a way to use one of those other sets.

What I did was use the curl script to get all the weather info that I needed and write that to a file on the disk in one call. With that, I didn't have to keep going back the the rss to get info for each item that I needed for display or to know what icon to copy for display.

If you look at the 'txt' files that are written by the curl script, you will see some information listed as "code=xx" where xx is a number that corresponds to the weather icon that should be displayed. That number is then used to determine the correct png file to copy for display … so now I can use my own images and am not forced to use the yahoo images.

The script that gets all the information (and writes it to disk) also copies the correct icon for display, and it also displays the weather text info.

So … to display my weather information, I only need 2 geeklets … 1 shell geeklet for the curl script and 1 image geeklet.

The 5 day weather forecast information works the same way as described above. The only difference is that the weather forecast uses 6 geeklets … 1 shell geeklet for the curl script, 1 image geeklet for each of the 5 days.
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.