Convert to Python

Posted on
Wed Aug 26, 2020 7:34 am
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Convert to Python

Appreciate any help with this one. Not sure about the "contains" part.

Code: Select all
tell application "IndigoServer"
   set theText to value of variable "Weather_Icon"
   if theText contains "Clear" then
      set the value of variable "Weather_Icon" to "Moon"
   else if theText contains "Cloudy" and theText contains "Mostly" then
      set the value of variable "Weather_Icon" to "Moon_Mostly"
end if
end tell


Thanks,

Carl

Posted on
Wed Aug 26, 2020 9:27 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Convert to Python

The in operator will probably do:

Code: Select all
theText = indigo.variable[ID_OF_Weather_Icon].value
if "Clear" in theText:
    indigo.variable.updateValue(ID_OF_Weather_Icon, value="Moon")
elif "Cloudy" in theText and "Mostly" in theText:
    indigo.variable.updateValue(ID_OF_Weather_Icon, value="Moon_Mostly")

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 26, 2020 3:09 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Convert to Python

Thanks Jay. Works great.

Carl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests