Always get stuck on something in Applescript land.
What's happening is I display a weather icon for tomorrows forecast based on info I download
from a weather site. The info they supply is always changing for some reason. One day it might
be, "Fog and Rain", then later, "Rain with Fog" making it cumbersome to use setting up variables.
In plugging along with this, I got it worked out to convert a "Fog and Rain", or "Rain and Fog"
to what I need.
The problem now is how to limit one like, "Some Rain" to not be triggered by the above, "Fog and Rain" and only
trigger when just "Rain" is present.
Essentialy looking for some code like this: if the theText contains ONLY the keepThis then
Really appreciate the help, someday I'll get a handle on this.
Thanks again,
Carl
Here's the general idea:
- Code: Select all
tell application "IndigoServer"
set theText to value of variable "Weather_Condition"
set keepThis1 to "Cloudy" as string
set keepThis2 to "Fair" as string
set keepThis3 to "Mist" as string
set keepThis4 to "Fog" as string
set keepThis5 to "Freezing" as string
set keepThis6 to "Hail" as string
if the theText contains the keepThis1 then
set the value of variable "Weather_Condition" to "Cloudy"
end if
if the theText contains the keepThis2 then
set the value of variable "Weather_Condition" to "Fair"
end if
if the theText contains the keepThis3 and theText contains the keepThis4 then
set the value of variable "Weather_Condition" to "Fog_Mist"
end if
if the theText contains the keepThis4 the keepThis3 then
set the value of variable "Weather_Condition" to "Fog"
end if