Page 3 of 3

Re: Convert to Python

PostPosted: Sat Aug 13, 2022 4:41 pm
by FlyingDiver
Oh, right, you're still running Python2.
Code: Select all
indigo.variable.updateValue('RainSeason',  "{:.2f}".format(rainSeason)

Re: Convert to Python

PostPosted: Sat Aug 13, 2022 6:41 pm
by ckeyes888
Sorry, same error.

Thanks,

Carl

Re: Convert to Python

PostPosted: Sat Aug 13, 2022 7:03 pm
by FlyingDiver
Missing right parenthesis at the end.

Re: Convert to Python

PostPosted: Sat Aug 13, 2022 7:08 pm
by ckeyes888
Perfect, thanks!

Carl

Re: Convert to Python

PostPosted: Sat Aug 13, 2022 7:30 pm
by ckeyes888
Thought based on the prior scripts I could do this one but no go.
Here's the AS:
Code: Select all
tell application "IndigoServer"
   set the value of variable "WUForecastAll" to (value of variable "WUForecast") & " " & (value of variable "WUHighTemp") & (ASCII character 188) & "/" & (value of variable "WULowTemp") & (ASCII character 188)
end tell


Here's what I have so far:
Code: Select all
WUForecastAll = indigo.variables[320389015].value  # ID of `WUForecastAll `
WUForecast = indigo.variables[431199923].value  # ID of `WUForecast `
WUHighTemp = indigo.variables[1796297015].value  # ID of `WUHighTemp `
WULowTemp = indigo.variables[1401542304].value  # ID of `WULowTemp

indigo.variable.updateValue(320389015, WUForecast + " " + WUHighTemp + "°" + "/" WULowTemp + "°") # ID of `WUForecastAll `


The format I'm after would be: Sunny 87°/56°

Hope I'm not overstepping with all these conversions.

Thanks,

Carl

Re: Convert to Python

PostPosted: Sat Aug 13, 2022 7:35 pm
by FlyingDiver
Don't use concatenation (the "+" signs). Use string formatting. Start here: https://www.w3schools.com/python/ref_string_format.asp

Re: Convert to Python

PostPosted: Sat Aug 13, 2022 8:38 pm
by ckeyes888
Think I got it. Many thanks!

Carl