Help With Applescript Conversion

Posted on
Mon Feb 27, 2023 8:46 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Help With Applescript Conversion

Hey,

Thought I had an example python script that I could adapt for this but cant come up with it.
Any help converting this to python very much appreciated.

Carl

Code: Select all
tell application "IndigoServer"
   set snowDay to the value of variable "SnowToday" as real
   set snowSeason to the value of variable "SnowSeason" as real
   
   set snowSeason to snowSeason + snowDay
   set the value of variable "SnowSeason" to snowSeason
end tell

Posted on
Tue Feb 28, 2023 11:07 am
Different Computers offline
User avatar
Posts: 2552
Joined: Jan 02, 2016
Location: East Coast

Re: Help With Applescript Conversion

What’s the end goal?

I have a trigger that tracks how many days since rain, and it doesn’t use any scripting at all.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue Feb 28, 2023 5:22 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Help With Applescript Conversion

Looks like he's accumulating the amount of snow for the season. Not sure you can do that with just the Indigo UI but I haven't tried.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Feb 28, 2023 5:38 pm
Different Computers offline
User avatar
Posts: 2552
Joined: Jan 02, 2016
Location: East Coast

Re: Help With Applescript Conversion

Yup, that makes sense.

I can count days since rain without a script, but I've never tried accumulating like that. It's probably way easier to do with Python than the UI.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue Feb 28, 2023 7:59 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Help With Applescript Conversion

Would be great to be able to perform simple math on variables.
And yes, the end goal is just to add the snow today variable to the snow season.

Carl

Posted on
Wed Mar 01, 2023 5:44 am
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Help With Applescript Conversion

ckeyes888 wrote:
Would be great to be able to perform simple math on variables.

Hi Carl - the Multitool plugin can do this. The Modify Numeric Variable Action will apply a simple formula whenever some condition takes place. For example, when variable B changes, add its new value to variable A.

Screenshot 2023-03-01 at 5.35.18 AM-2.png
Screenshot 2023-03-01 at 5.35.18 AM-2.png (151.34 KiB) Viewed 1281 times


Var A = Foo05
Var B = Variable 1321357402 (right click on a variable to get its substitution string)
Operator: +
Formula: +%%v:1321357402%%

If you click on the question mark in the dialog above, it will open this tutorial page on the plugin wiki.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Mar 01, 2023 9:34 am
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Help With Applescript Conversion

That's perfect. Yet another reason for me to pull the trigger to update to 2022. I'm still using 7.2...tons of applescripts to deal with and it's been working perfectly for years.
Not looking forward to everything that will likely break.

Thanks,

Carl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests