Simple question, If greater than x and less than y, how? #Applescript

Joined
Dec 1, 2008
Messages
7
Reaction score
0
Points
1
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:
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/
 
Joined
Mar 30, 2004
Messages
4,744
Reaction score
381
Points
83
Location
USA
Your Mac's Specs
12" Apple PowerBook G4 (1.5GHz)
I think what you're missing is....
Code:
...
if weather_cur is greater than 32 and [b]weather_cur is[/b] less than or equal to 55 then
...
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top