About this forum

Posted on
Fri Sep 29, 2017 3:06 pm
jay (support) offline
Site Admin
User avatar
Posts: 16821
Joined: Mar 19, 2008
Location: Austin, Texas

About this forum

We've decided to create this forum for those that are starting down the road of converting AppleScript scripts to Python. If you have an issue, post a script snippit, explain the context in which the script is running, and we'll try to help you convert it. Note that rather than converting, we may identify a plugin that may help with part of the solution and may mean no coding at all. This is why it's important to not just post AppleScript code, but also explain how it's used and the context.

Reitering some details discussed elsewhere on the forums and in the blog post

It may also help to describe what the overall solution is that the AppleScript is solving is, so if you can describe the scenario that would be helpful as well.

In order to continue to help everyone understand what's going to work and what's not, we'll summarize here as well. AppleScripts that target the Indigo Server are the ones that will need attention. So if your script has a tell application "IndigoServer" in it will no longer work. Likewise, if you have an embedded script that targets any Indigo objects (embedded scripts don't strictly need to have a tell block in them) or execute commands, it will no longer work.

Here are some examples of things that won't work (not an exhaustive list):

Code: Select all
turn on device "My Device Here"
set value of variable "My Variable" to "some value here"
make new variable with properties {name: "My New Variable", value: "the new value here"}
calculate sunrise
send email to "someaddress" with subject "My Subject" with body "My email body"

Just a few examples - anything in the Indigo Server's AppleScript dictionary will no longer work.

However, any script that talks to other applications will work. For instance:

Code: Select all
tell application "iTunes
    # Any iTunes command
    play
end tell

will work fine when run from an external AppleScript file because it only targets iTunes. Likewise, if you have scripts that send curl commands, which is an easy way to integrate control of web-based services, those will continue to work as long as they don't attempt to talk to the Indigo Server:

Code: Select all
do shell script " curl 'http://192.168.0.2/api/v1/runactivity' -d '{ \"activity_uuid\" : \"someidgoeshere\", \"toggle_state\" : \"on\" }' "

While that particular command can easily be done in Python as well, it will continue to work since it doesn't target the Indigo Server.

A Note about Embedded AppleScripts

While we have yet to make the final decision (we'll update this post when we do), we expect that you won't be able to embed AppleScripts any more, so the only way to execute them will be via an external script file. That's not likely to be a big deal to many of you since we've long warned everyone that external scripts are better because they don't have to run directly in the Indigo Server, but we just wanted to give you a heads up.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Apr 04, 2018 7:36 am
McJohn offline
User avatar
Posts: 511
Joined: Dec 18, 2012
Location: The Netherlands

Re: About this forum

Question Jay;

We read in the latest news letter that the support of AppleScript in Indigo 7.2 is ending.
The question is: is this also for the external AppleScript file support or only for the embedded AppleScripts?

Thanks and kind regards,

John

Posted on
Wed Apr 04, 2018 8:18 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: About this forum

I'm not Jay, but anything that targets the Indigo server will no longer be supported. There's a handful of posts about this, but here is a link to a reply Jay made regarding this.

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
Wed Apr 04, 2018 10:43 am
jay (support) offline
Site Admin
User avatar
Posts: 16821
Joined: Mar 19, 2008
Location: Austin, Texas

Re: About this forum

I've updated the OP to reiterate some of the details that we talk about in other places.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Apr 04, 2018 12:55 pm
McJohn offline
User avatar
Posts: 511
Joined: Dec 18, 2012
Location: The Netherlands

Re: About this forum

Thank you both for your time and the clear explanation! :D

Posted on
Tue Apr 24, 2018 2:56 pm
Jann offline
Posts: 105
Joined: Mar 12, 2006
Location: Auburndale, FL

Re: About this forum

One Q: If I understand this correctly, Indigo WILL NOT listen for AppleScript anymore (ie: another external script saying “tell IndigoServer” but it will *still* run embedded AppleScript via osascript If ALL I'm doing is communicating w/other apps on that Mac?

ie: This would work: (it simply stores current Mac volume, sets it to 80, plays a sound that indicates house alarm is deactivated, and resets the volume to what it was PRIOR to playing the sound)

Code: Select all
set original_volume to output volume of (get volume settings)

set volume output volume 80
do shell script "afplay '/Users/jgobble/Music/beeps/alarm_deactivate.aif'"

set volume output volume original_volume


Or is this not gonna work as an "embedded AppleScript" either?

I ask because I searched the XML of the indigo server database for "indigoserver" and found no locations in that file that have that string. I *only* use embedded AppleScript so this should've found it if i needed to worry about it, right?

side Q: Is there no easier way to play a sound?

Posted on
Tue Apr 24, 2018 3:09 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: About this forum

Why not hedge your bets and just put that into an AppleScript file and then you can execute it from Indigo using my plugin or the AppleScript python library or an oascript shell call? All the indications I'm getting is "ditch AppleScript with Indigo" be that external references or embedded, I've decided to take this at its word and move all AS functions out of Indigo entirely and use the plugin I wrote to run them as needed or even embed it into python for a quick-and-easy method.

That being said, you do not target Indigo so if that script is external then it will work. If you put quotes around it and send it the python AppleScript library it will work, but having the AppleScript natively executed in Indigo likely will not.

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
Tue Apr 24, 2018 3:34 pm
Jann offline
Posts: 105
Joined: Mar 12, 2006
Location: Auburndale, FL

Re: About this forum

I'd love to ditch them all, but that will have to be over time (a month or so) ...

What is the name of your plugin for running the script in a separate file? I know I can use osascript but it tends to hang... a lot!

Posted on
Tue Apr 24, 2018 3:36 pm
Jann offline
Posts: 105
Joined: Mar 12, 2006
Location: Auburndale, FL

Re: About this forum

also is it just "run shell" with "/usr/bin/osascript /path/to/my/applescript" if i decide to use osascript?

Posted on
Tue Apr 24, 2018 3:57 pm
jay (support) offline
Site Admin
User avatar
Posts: 16821
Joined: Mar 19, 2008
Location: Austin, Texas

Re: About this forum

Embedded scripts won't run as they are now because those are run in the IndigoServer process. We haven't yet decided if we'll leave the edit box in there and just run the scripts via osascript or if we'll just require scripts to be external (which are already run via osascript - no reason to do it yourself).

You will run an external AppleScript the same way you always have - use the Execute Script action, point the action to an AppleScript. Nothing to change about that.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests