I recently found speech commands; and might I add, I am in love. Currently scripting a weather command that will relay the weather and suggest a proper dress for my daughter when she is picking out her clothes. Everything works great with the exception of my if-then statements that have to to with being greater than a number and less than another. I personally haven't been able to find anything in regards to combining both greater than and less than, though i am sure its very simple.
The commented out part is where I am experiencing trouble:
To give credit where its due:
The commented out part is where I am experiencing trouble:
Code:
set weather_loc to "/Scripts/weather"
set weather_spk to ""
set weather_cur to do shell script (weather_loc & " 48413")
set d to text item delimiters
set text item delimiters to "F"
set weather_cur to weather_cur's text items
set text item delimiters to ""
tell weather_cur to set weather_cur to item 1 & ({""} & rest)
set text item delimiters to d
if weather_cur is less than or equal to "32" then
set weather_spk to "The temperature is currently a freezing " & weather_cur & " degrees. Suggested dress: multiple, heavy layers."
end if
--if weather_cur is greater than 32 and less than or equal to 55 then
--set weather_spk to "The temperature is currently a chilly " & weather_cur & " degrees. Suggested dress: medium layers."
--end if
--if weather_cur is greater than 55 and less than or equal to 75 then
--set weather_spk to "The temperature is currently a plesant " & weather_cur & " degrees. Suggested dress: light layers. T-shirt and jeans are acceptable."
--end if
--if weather_cur is greater than 75 and less than or equal to 85 then
--set weather_spk to "The temperature is currently a warm " & weather_cur & " degrees. Suggested dress: T-shirt and jeans, shorts optional."
--end if
--if weather_cur is greater than 85 and less than or equal to 95 then
--set weather_spk to "The temperature is currently a hot " & weather_cur & " degrees. Suggested dress: T-shirt and jeans. Shorts recommended, tank top optional."
--end if
if weather_cur is greater than "95" then
set weather_spk to "The temperature is currently a blistering " & weather_cur & " degrees. Suggested dress: Tank top and shorts."
end if
say weather_spk
To give credit where its due:
Code:
Fetches weather reports from Yahoo!
Written by Thomas Upton (http://thomas.fiveuptons.com/),
with contributions from Chris Lasher (http://igotgenes.blogspot.com/).
This code is licensed under a BY-NC-SA Creative Commons license.
http://creativecommons.org/licenses/by-nc-sa/3.0/us/