The future of AppleScript and Indigo Announcement

Posted on
Sun Sep 24, 2017 4:21 pm
jrickmd offline
Posts: 109
Joined: Jun 01, 2003
Location: Texas

Re: The future of AppleScript and Indigo Announcement

So I have spent the last week in finding and converting my AppleScript within Indigo. I had 50+ instances and haven't finished yet. Yes, very trying, but also somewhat fun to re-think several of my systems. I have gotten by with very little "hacks" as I would call them, but am having difficulty with the lack of python support for schedules. Particularly, in the ability to manipulate the "countdown delta" of the time date action. I have found a workaround in my "security walk" script that randomly turns on and off a set of lights while we are away. This involved time.sleep() calls with random numbers in an external python script. I don't like the fact that there is a script on the system waiting 45 minutes or more at times before it un-sleeps, but it's what I've got at the moment. Any concerns with that or alternate schools of thought?

The area I can't come up with anything at this point is in setting the delta for updating "time since" variables in my system. For example, my control pages show the last time each door sensor was triggered in my system, or the last time a light was toggled, or the last time a motion sensor was triggered, etc. If its been within 90 seconds, the control page variable is updated every couple of seconds. If it's been less than a few minutes, it updates every 10 seconds. More than 10 minutes, it updates every 60 seconds, etc. I do this my changing the countdown delta of a time date action at present. Anyone with ideas how to do the same thing with our python environment?

Rick

Posted on
Mon Sep 25, 2017 9:37 am
jay (support) offline
Site Admin
User avatar
Posts: 14533
Joined: Mar 19, 2008
Location: Austin, Texas

Re: The future of AppleScript and Indigo Announcement

jrickmd wrote:
So I have spent the last week in finding and converting my AppleScript within Indigo. I had 50+ instances and haven't finished yet. Yes, very trying, but also somewhat fun to re-think several of my systems. I have gotten by with very little "hacks" as I would call them, but am having difficulty with the lack of python support for schedules. Particularly, in the ability to manipulate the "countdown delta" of the time date action. I have found a workaround in my "security walk" script that randomly turns on and off a set of lights while we are away. This involved time.sleep() calls with random numbers in an external python script. I don't like the fact that there is a script on the system waiting 45 minutes or more at times before it un-sleeps, but it's what I've got at the moment. Any concerns with that or alternate schools of thought?


We definitely do have plans to complete the IOM with full schedule/trigger/condition/action support. To be honest, there don't appear to be many people modifying those from AppleScript so it's been a lower priority. It's nice to hear some concrete examples. As for external scripts that are long-running, those are fine. They run in their own process and don't take up much in terms of resources when they're sleeping. I have a few of those that I haven't converted into plugins and I have no problems with them.

jrickmd wrote:
The area I can't come up with anything at this point is in setting the delta for updating "time since" variables in my system. For example, my control pages show the last time each door sensor was triggered in my system, or the last time a light was toggled, or the last time a motion sensor was triggered, etc. If its been within 90 seconds, the control page variable is updated every couple of seconds. If it's been less than a few minutes, it updates every 10 seconds. More than 10 minutes, it updates every 60 seconds, etc. I do this my changing the countdown delta of a time date action at present. Anyone with ideas how to do the same thing with our python environment?


Check out the SecondsSinceLastChange plugin - it may not do everything you want, but I suspect it'll get you most of the way there.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Sep 26, 2017 6:29 pm
hamw offline
Posts: 1090
Joined: Mar 31, 2008

Re: The future of AppleScript and Indigo Announcement

Jay, have you updated your thermostat script as well as the alarm clock script?

Posted on
Tue Sep 26, 2017 8:08 pm
kw123 offline
User avatar
Posts: 5739
Joined: May 12, 2013
Location: Dallas, TX

Re: The future of AppleScript and Indigo Announcement

That's what I am?


Sent from my iPhone using Tapatalk

Posted on
Tue Sep 26, 2017 8:30 pm
hamw offline
Posts: 1090
Joined: Mar 31, 2008

Re: The future of AppleScript and Indigo Announcement

Matt and Jay,

Another plea for keeping AS. While Indigo is definitely a tool for the tech inclined. the degree of skill varies among us. AS might be deprecated down the road but not yet. While for you all it might be some effort to bake in AS to the new 64 bit architecture, think of the collective effort and frustration you are putting your end users through. And also, the simple if-then statements of AS, even though they can get a little arcane, are much easier and a lot less scary for not-really-tech-savvy types like myself. Are you sure you won't be alienating a good part of your user base, and leaving out a user-friendly entry level option for newbies?

Just a thought.

Ham

Posted on
Tue Sep 26, 2017 9:15 pm
jay (support) offline
Site Admin
User avatar
Posts: 14533
Joined: Mar 19, 2008
Location: Austin, Texas

Re: The future of AppleScript and Indigo Announcement

hamw wrote:
Jay, have you updated your thermostat script as well as the alarm clock script?


I updated the thermostat script a couple of years ago. I don't believe I wrote an alarm clock script but if you can point to it I suspect someone can help migrate. There might be a plugin that already does what you're looking for in that respect.

hamw wrote:
Are you sure you won't be alienating a good part of your user base


Yes, we're quite confident.

hamw wrote:
and leaving out a user-friendly entry level option for newbies?


Our target market doesn't need AppleScript. Newbies don't require scripting to get started - plugins fill a lot of what scripts used to do. Getting help with scripts to do what is needed for more advanced things is pretty easy here on the forums. We have decided that spending months of time trying to support something that even Apple doesn't appear to be too committed to makes no business sense.

We totally understand that change is painful. This is why we've been talking about the eventual deprecation of AppleScript for many years. But, for Indigo to move forward in the way that we need it to, AppleScripts that target Indigo must be left behind. There are alternatives that we've addressed in other places and we think once you get past the "oh crap" phase you'll find that converting isn't really going to be that big of a deal. And it's not happening tomorrow - you have many months to complete the transition if you want to be prepared for the 7.2 release next year. Just don't put it off any longer (which many people have done despite our warnings about the end of AppleScript support).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Sep 27, 2017 7:02 am
matt (support) offline
Site Admin
User avatar
Posts: 18507
Joined: Jan 27, 2003
Location: Texas

Re: The future of AppleScript and Indigo Announcement

Hi Ham,

Unfortunately, as Jay said we won't be changing our development plans. I've looked at it in detail several times and the amount of work to convert Indigo's current AppleScript API/object mode/framework over is at least one order of magnitude too high to justify. And even the work to convert it was done, given the complexity and nature of the object model and the massive changes in how the two frameworks work, there would be lots of issues with bugs and scripts not working. It really is an engineering and QA nightmare. If it were easy, or even moderately difficult, we would consider doing it. Unfortunately, it just isn't.

For some examples on controlling Indigo via Python and converting AppleScripts to Python, see the scripting tutorial, the devices object model documentation, and variables object mode documentation. There are also some forum threads with good discussions and examples and feel free to post any AppleScripts you are struggling to convert on the forum here.

Post up an AppleScript of yours (let's start with some smaller ones) and let's see what it takes to get it converted. The change to python might seem overwhelming at first, but I think once you spend some effort working on it you will feel more comfortable. Although AppleScript on first glance might seem more "nature language"-like and less scary, in reality I've found that it is frustrating because the verbs/prepositions still have to be carefully selected for the language constructs to work correctly. In that sense Python is much more straightforward, concise, and predictable.

Image

Posted on
Wed Sep 27, 2017 9:21 am
Different Computers offline
User avatar
Posts: 1832
Joined: Jan 02, 2016
Location: East Coast

Re: The future of AppleScript and Indigo Announcement

Is everyone here who's worried totally tuned in that this is for AppleScripts that must talk TO Indigo? Essentially ones that have
Code: Select all
tell IndigoServer
in them and nothing else. Everything else can just be jammed into an external script and Indigo can still fire it off.

That said, I just realized some of my iTunes AppleScripts set Indigo variables for things like rating, volume, and such like. Any way to have an AppleScript execute python, or conversely, to have Python get iTunes info?

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Wed Sep 27, 2017 10:37 am
jay (support) offline
Site Admin
User avatar
Posts: 14533
Joined: Mar 19, 2008
Location: Austin, Texas

Re: The future of AppleScript and Indigo Announcement

Different Computers wrote:
That said, I just realized some of my iTunes AppleScripts set Indigo variables for things like rating, volume, and such like. Any way to have an AppleScript execute python, or conversely, to have Python get iTunes info?


http://www.indigodomo.com/blog/2017/09/ ... nd-indigo/

Volume is available using the iTunes plugin.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Sep 27, 2017 10:42 am
Different Computers offline
User avatar
Posts: 1832
Joined: Jan 02, 2016
Location: East Coast

Re: The future of AppleScript and Indigo Announcement

Thanks Jay.

I should have spoken more carefully: Volume of AirPlay devices.

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Wed Sep 27, 2017 11:02 am
jay (support) offline
Site Admin
User avatar
Posts: 14533
Joined: Mar 19, 2008
Location: Austin, Texas

Re: The future of AppleScript and Indigo Announcement

Let's move your discussion over to the other thread you started about iTunes in python scripts - I've replied there already.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Oct 08, 2017 10:42 am
rycardo offline
Posts: 53
Joined: Jul 10, 2015

Re: The future of AppleScript and Indigo Announcement

Hey guys,

Is it possible for an embedded python script to import/include an external python file?

For example a constants.py or funcs.py

I'v searched here, and can't find the way to do it, assuming it's possible.

In case it matters, these files are in the Indigo 7/scripts folder.

Thanks,

Rycardo

Posted on
Sun Oct 08, 2017 10:47 am
matt (support) offline
Site Admin
User avatar
Posts: 18507
Joined: Jan 27, 2003
Location: Texas

Re: The future of AppleScript and Indigo Announcement

Hi Rycardo,

Yes, read over this section.

Image

Posted on
Sun Oct 08, 2017 10:49 am
rycardo offline
Posts: 53
Joined: Jul 10, 2015

Re: The future of AppleScript and Indigo Announcement

I don't know how I missed that in all my searching last night!

Thank You!

Who is online

Users browsing this forum: No registered users and 1 guest