Part .1 will deal with setting up the needed scripts.
Part .2 will deal with setting the scripts to automatically run/update at boot and then every hour after.
This tutorial is aimed at Lucid Puppy as this is what i am using, although the set up is relatively simply so it will probably work on other versions of puppy to.
Before i start - this Script relies on informations from the website http://weather.noaa.gov/ please visit this site first and ensure you can find a suitable weather station at or near your location before proceeding. (If you have found a suitable weather station please bookmark the page in your web browser as we will need to re-visit the page in step .2 of this tutorial)
Desktop Weather Script.
Desktop Weather Script is a simple weather script for Puppy Linux, it will download from the internet the current weather conditions for your local area and display that information on your desktop in an xmessage window.
Step 1.
First thing to do is create two new Scripts in /root/my-applications/bin
Name Script one: weather.get
Name Script two: weather.show
*If you are unsure on how to create a Script navigate to /root/my-applications/bin with Rox file manager.
Then inside the Rox file manager window Right mouse button click>New>Script
Step 2.
Script one: weather.get
Open the weather.get script with Geany text editor.
*If you are unsure on how to open a Script in text editor - navigate to the script with Rox file manager then on the Script you wish to open Right mouse button click>File'Script name'>Open as Text
Now you have the weather.get Script open in Geany text editor copy (Ctrl + c) and paste (Ctrl + v) the below code but don't save yet.
Code for weather.get
Code: Select all
#!/bin/sh
if [ /root/forecast.txt ];then
rm /root/forecast.txt
fi
wget -O forecast.txt http://weather.noaa.gov/pub/data/observations/metar/decoded/EGXE.TXT
Please visit the http://weather.noaa.gov/ local weather station page you bookmarked before starting this tutorial.
On the webpage you will see a code, this code is for your local weather station.
You need to copy this code (Ctrl + c) and paste (Ctrl + v) it into your weather.get Script.
*Make sure to delet the code that is already in your weather.get script as this is the code for my local weather station.
When you have done this in the Geany text editor save the weather.get Script.
Step 3.
Script two: weather.show
Open the weather.show script with Geany text editor.
Now you have the weather.show Script open in Geany text editor copy (Ctrl + c) and paste (Ctrl + v) the below code but don't save yet.
Code for weather.show
Code: Select all
#!/bin/sh
xmessage -buttons "5 Day Forecast:1,10 Day Forecast:2,Exit:3" -fg "#333333" -bg "#E7E7E7" -center -title Weather -file /root/forecast.txt -timeout 18
case $? in
1)
defaultbrowser http://news.bbc.co.uk/weather/forecast/340
;;
2)
defaultbrowser http://uk.weather.com/weather/10day-Leeming-ukxx0173
;;
esac
As the 5 and 10 day forecasts are displayed in your web browser you can use any website you like that provides the forecast for your local area.
Once you have found suitable 5 and 10 day weather forecast for your local area you will need to copy (Ctrl + c) and paste (Ctrl + v) the full website address into your weather.show Script code.
*Make sure to delet the website address code that is already in your weather.show script as this is the code for my local weather station.
The defaultbrowser section in the weather.show script are to launch what ever web browser you have installed in Puppy as default - however you can change this to use which ever web browser you like - simply replace 'defaultbrowser' with the path to an executable of the web browser of your choosing - The web browser executable are usualy located in /usr/bin
When you have done this in the Geany text editor save the weather.show Script.
Step .4
This step is for JWM windows manager.
Now we have the weather.show script set for your local area other than clicking directly on the weather.show script or typing weather.show in rxvt terminal we need a convenient way to launch it from the desktop.
In Rox file manager navigate to your /root directory and open the .jwmrc-tray file in Geany text editor.
*If you do not see a .jwmrc-tray file in/root in a clear area of the Rox file manager window Right mouse button click>Display>Show Hidden
Copy the below code into your .jwmrc-tray file (my preferred location for this code is just in front of the clock code)
Code: Select all
<TrayButton label="W">exec:/root/my-applications/bin/weather.show</TrayButton>
When you have done this in the Geany text editor save the .jwmrc-tray file.
The above will add a 'W' for weather just infront of the clock in the JWM tray click on the 'W' will launch your weather.show Script.