Page 1 of 1

Help With Applescript Conversion

PostPosted: Mon Feb 27, 2023 8:46 pm
by ckeyes888
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

Re: Help With Applescript Conversion

PostPosted: Tue Feb 28, 2023 11:07 am
by Different Computers
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.

Re: Help With Applescript Conversion

PostPosted: Tue Feb 28, 2023 5:22 pm
by FlyingDiver
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.

Re: Help With Applescript Conversion

PostPosted: Tue Feb 28, 2023 5:38 pm
by Different Computers
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.

Re: Help With Applescript Conversion

PostPosted: Tue Feb 28, 2023 7:59 pm
by ckeyes888
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

Re: Help With Applescript Conversion

PostPosted: Wed Mar 01, 2023 5:44 am
by DaveL17
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 1387 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.

Re: Help With Applescript Conversion

PostPosted: Wed Mar 01, 2023 9:34 am
by ckeyes888
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