The future of AppleScript and Indigo Announcement

Posted on
Sun Sep 17, 2017 8:55 pm
nev offline
Posts: 48
Joined: Aug 19, 2015

The future of AppleScript and Indigo Announcement

Hi All,
I read this announcement and need to clarify if I only need to convert embedded AppleScript to Python or any AppleScript including a "Execute Script (Script & File Actions)" if that also points to an AppleScript. Embedded only means a good amount of work, but if its both, then I'm just going to start over as its a stupid amount of work i'd have to do.

http://www.indigodomo.com/blog/2017/09/09/future-applescript-and-indigo/

Posted on
Sun Sep 17, 2017 9:27 pm
hamw offline
Posts: 1212
Joined: Mar 31, 2008

Re: The future of AppleScript and Indigo Announcement

I think this is a terrible mistake. I have too much that depends on AppleScript. Changing everything to python will be unbelievably difficult; I am not a programmer by nature but through a lot of hard work including hours of rewriting things I have made some very effective scripts. Why are you doing this unless it is absolutely necessary? I will not be able to upgrade beyond 7.1, obviously.
Last edited by hamw on Mon Sep 18, 2017 7:25 am, edited 1 time in total.

Posted on
Sun Sep 17, 2017 10:35 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: The future of AppleScript and Indigo Announcement

Same here. I have, with the help of many here, years of work into Applescripts.
If 7.1 is the last of the support for it then that's it for any continuation with Indigo and me.

Carl

Posted on
Mon Sep 18, 2017 1:16 am
Shutter online
Posts: 345
Joined: Mar 07, 2014
Location: London, UK

Re: The future of AppleScript and Indigo Announcement

I too use a number of AppleScripts, which I found over the years on this forum - I can't code so have no chance converting them to Python. I did, over the last year, reduce my dependance on AppleScript, and tried to find Python equivalents, but still not 100%

It would be nice if we had a Python repository of scripts that people could use, and which if commented might be modifiable even by those who can't code.

Just a thought. Anyone willing to share?

Posted on
Mon Sep 18, 2017 1:25 am
citysnaps offline
Posts: 44
Joined: Jul 13, 2016

Re: The future of AppleScript and Indigo Announcement

Looks like I'll be staying with 7.1 for awhile.

...........................
Brad
Urban photoblog: www.citysnaps.net

Posted on
Mon Sep 18, 2017 3:35 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: The future of AppleScript and Indigo Announcement

There are a lot of reasons we are pushing users to transition away from AppleScript:

• Apple is dropping support for 32-bit binaries in June and Indigo's AppleScript integration is built on top of a 3rd party 32-bit library and Apple 32-bit framework that aren't being updated to 64-bit. We would have to completely rewrite our AppleScript integration layer to a different framework, a task which would take significant engineering and QA time.

• Apple's ongoing commitment to AppleScript appears weak. Even if we were able to update Indigo to support AppleScript on 64-bit only macOS releases, how much longer will Apple continue to support and maintain AppleScript going forward? We think the writing is on the wall for its deprecation.

• Python has proven to be a much more reliable scripting environment, and has a strong community of developers. Additionally, Python is open source and even if Apple no longer included Python in a future macOS release we could embed our own version.

Note again that only AppleScripts that target Indigo will need attention. AppleScripts that are being used to command/control other macOS apps will work (although they might have to be saved as external AppleScript files instead of being embedded). We know the transition won't be trivial for some of our users, but we are here to help answer any questions you might have on converting your AppleScripts.

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.

Image

Posted on
Sat Sep 23, 2017 10:34 am
nev offline
Posts: 48
Joined: Aug 19, 2015

Re: The future of AppleScript and Indigo Announcement

Thanks for the additional info on reasoning behind the change, this helps! I think like anything, people (including myself) are somewhat change resistant initially and especially when it means a great deal of work to switch everything over we have customized. Perhaps if we can get a little assistance with some core functions, it would make the transition to a new language easier. We really appreciate the assistance!

Running a curl script using a indigo variable value:

applescript
Code: Select all
tell application "IndigoServer"
   set MakerKey to the value of variable "MakerKey"
end tell
do shell script "curl -X POST https://maker.ifttt.com/trigger/some_light_off/with/key/" & MakerKey


python (not working)
Code: Select all
#! /usr/bin/env python
import commands,os,random,sys
myvar = indigo.variables[1234..]
os.system(curl -X POST https://maker.ifttt.com/trigger/some_light_off/with/key/ & myvar)

Posted on
Sat Sep 23, 2017 12:04 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: The future of AppleScript and Indigo Announcement

Without checking your curl code, I can spot one thing - to get the value of the variable you have to specify:
Code: Select all
myvar = indigo.variables[1234..].value

For more detail on variables see this documentation page: http://wiki.indigodomo.com/doku.php?id=indigo_7_documentation:variable_class :)

Posted on
Sat Sep 23, 2017 1:19 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: The future of AppleScript and Indigo Announcement

What Jon said, but also take a look at using the python requests library for making the HTTPS call. Something like this (untested):

Code: Select all
import requests

myvar = indigo.variables[1234].value
url = "https://maker.ifttt.com/trigger/some_light_off/with/key/" + myvar
r = requests.get(url)

# Example of logging to Indigo the HTTP result status code and text:
indigo.server.log("result status: %d, text: %s" % (r.status_code, r.text))

And here is some more information (and examples) on using the requests library.

Image

Posted on
Sat Sep 23, 2017 4:17 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: The future of AppleScript and Indigo Announcement

The requests library (which we include with Indigo 7+) makes using curl satisfying only for masochists.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Sep 23, 2017 10:08 pm
nev offline
Posts: 48
Joined: Aug 19, 2015

Re: The future of AppleScript and Indigo Announcement

Your combine posts filled in the gaps and its working well! One script done, many more to go... but at least I'll still have time to do it. Thanks for the quick info!!!

Posted on
Sun Sep 24, 2017 8:38 am
Korey offline
User avatar
Posts: 811
Joined: Jun 04, 2008
Location: Henderson, NV

Re: The future of AppleScript and Indigo Announcement

How about a Applescript to Python converter / Plugin :wink:

--
Korey

Posted on
Sun Sep 24, 2017 10:17 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: The future of AppleScript and Indigo Announcement

Korey wrote:
How about a Applescript to Python converter / Plugin :wink:


That would be quite an undertaking. My take on this was similar though, it might be nice to have a feature in Indigo that says - perhaps in 7.0.5 or something - "list AppleScript dependancies" or something that we can pull a report and start converting. There's a lot of my old stuff that just simply still works so I have had no desire to reinvent the wheel when the old wheel is still rolling. This is to say I have probably 30-40 AppleScript things still on Indigo and it's going to take some effort to locate them all and fix them.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Sun Sep 24, 2017 10:21 am
nev offline
Posts: 48
Joined: Aug 19, 2015

Re: The future of AppleScript and Indigo Announcement

Right on the money as usual Colorado4Wheeler!!! A report like that would assist greatly. As we make our way through converting everything, a report would allow us to see what we missed vs waiting until something breaks and investigating why.

Posted on
Sun Sep 24, 2017 1:29 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: The future of AppleScript and Indigo Announcement

Colorado4Wheeler wrote:
My take on this was similar though, it might be nice to have a feature in Indigo that says - perhaps in 7.0.5 or something - "list AppleScript dependancies" or something that we can pull a report and start converting.


Seems like it may be as simple as searching the Indigo database for the XML tag AppleScriptSCPT. I think that would give you the nodes that contain AppleScript, and then you could print out whatever aspects of the node you wanted.

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

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 2 guests