The future of AppleScript and Indigo Announcement

Discuss Python scripts here.
jrickmd
Posts: 109
Joined: Sun Jun 01, 2003 3:21 pm
Location: Texas

Re: The future of AppleScript and Indigo Announcement

Post by jrickmd »

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
User avatar
jay (support)
Site Admin
Posts: 18420
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: The future of AppleScript and Indigo Announcement

Post by jay (support) »

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
hamw
Posts: 1248
Joined: Mon Mar 31, 2008 7:45 pm

Re: The future of AppleScript and Indigo Announcement

Post by hamw »

Jay, have you updated your thermostat script as well as the alarm clock script?
User avatar
kw123
Posts: 8458
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: The future of AppleScript and Indigo Announcement

Post by kw123 »

That's what I am?


Sent from my iPhone using Tapatalk
hamw
Posts: 1248
Joined: Mon Mar 31, 2008 7:45 pm

Re: The future of AppleScript and Indigo Announcement

Post by hamw »

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
User avatar
jay (support)
Site Admin
Posts: 18420
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: The future of AppleScript and Indigo Announcement

Post by jay (support) »

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
User avatar
matt (support)
Site Admin
Posts: 21476
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: The future of AppleScript and Indigo Announcement

Post by matt (support) »

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
User avatar
Different Computers
Posts: 2610
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

Re: The future of AppleScript and Indigo Announcement

Post by Different Computers »

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?
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
User avatar
jay (support)
Site Admin
Posts: 18420
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: The future of AppleScript and Indigo Announcement

Post by jay (support) »

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
User avatar
Different Computers
Posts: 2610
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

Re: The future of AppleScript and Indigo Announcement

Post by Different Computers »

Thanks Jay.

I should have spoken more carefully: Volume of AirPlay devices.
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
User avatar
jay (support)
Site Admin
Posts: 18420
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: The future of AppleScript and Indigo Announcement

Post by jay (support) »

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
rycardo
Posts: 53
Joined: Fri Jul 10, 2015 6:22 pm

Re: The future of AppleScript and Indigo Announcement

Post by rycardo »

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
User avatar
matt (support)
Site Admin
Posts: 21476
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: The future of AppleScript and Indigo Announcement

Post by matt (support) »

Hi Rycardo,

Yes, read over this section.
Image
rycardo
Posts: 53
Joined: Fri Jul 10, 2015 6:22 pm

Re: The future of AppleScript and Indigo Announcement

Post by rycardo »

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

Thank You!
Post Reply

Return to “Python Scripting”