Hi All,

**** Disclaimer ****
Those of you who choose to follow these steps do so at their own risk. I take 
no responsibility for any problems or issues you may encounter. These steps are 
straight forward but not for the faint of heart.

Ok, so now that I got that out of the way lets begin.

Step 1: If you do not already have it installed go to the Mac App Store and get 
Xcode. Once it has completed downloading go to Applications in the Finder and 
open the "Install Xcode" installation package. Follow all the install prompts.

Step 2: Go to http://www.macports.org and get the latest install for your 
version of the operating system. They have Lion. Once it's downloaded open the 
DMG and then the PKG and follow the install instructions.

Step 3: Open a terminal and at the prompt type the following command:

sudo port install lynx

Please note that lynx is spelled l y n x. For those of you who are not familiar 
with lynx, it's a command line browser. Once the install is completed and you 
are placed back at a prompt,  command q out of the terminal.

Step 4: From Utilities open the Apple Script Editor and cut and paste the 
following code into the edit area.

--- Code Starts Here ---
# Script to have Voice Over speak the current temperature.
# Written by Keith Watson on September 10, 2011.
#
# Using lynx get forecast from wunderground and dump to a text file.
do shell script "/opt/local/bin/lynx -dump 
http://www.wunderground.com/cgi-bin/findweather/getForecast?query=33617 | grep 
-m 1 -A 1 Temperature >/tmp/weather.tmp"
#
# Convert text dump from lynx to UTF-8 format.
#
do shell script "/usr/bin/iconv -f ISO-8859-1 -t UTF-8 /tmp/weather.tmp > 
/tmp/weather"
#
# Have say parse the text file to Alex or your voice of choice.
# The -r value is in words per minute. The higher the faster.
#
do shell script "/usr/bin/say -v Alex -r 450 -f /tmp/weather"
#
# Clean up after myself.
#
do shell script "rm /tmp/weather*"
--- Code Ends Here ----

Be sure to change my zip code for yours. 33617 to your zip code. Also for the 
fun of it you can change the line with "-v Alex -r 450" to your favorite voice 
and a comfortable rate.

Save the file in a location that you are going to remember. I have created a 
sub directory in my Documents folder called Scripts and save my Apple Scripts 
in there. You can test the script by running it with a "command r". If all is 
well, exit the editor.

Step 5: Open the Voice Over Utility and add the script to your favorite 
commander. I chose lower case w from the keyboard commander so that I could 
eventually add capital W for the full up forecast. Will post that script after 
I write it.

I have a request for those of you who may be familiar with Apple Scripting. 
This script is not very elegant since I brute force converted it from an old 
bash script. I am just getting started with Apple Scripting and if you see a 
better way to do this please feel free to make any changes and post here.

Thakns,

Keith

-- 
You received this message because you are subscribed to the Google Groups 
"MacVisionaries" group.
To post to this group, send email to macvisionaries@googlegroups.com.
To unsubscribe from this group, send email to 
macvisionaries+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/macvisionaries?hl=en.

Reply via email to