Calling IndigoPluginHost from an AppleScript

Posted on
Mon Apr 17, 2017 7:36 pm
chobo offline
Posts: 109
Joined: Dec 08, 2013
Location: USA

Calling IndigoPluginHost from an AppleScript

Also experiencing these "Application isn't running -600" errors after an upgrade to Mavericks. Had only two external AppleScripts left and was successfully able to convert them to curl. This works fine, but I'm not a fan of keeping credentials in plain text:

Code: Select all
curl -u user:pass --anyauth -X PUT -d value=true http://127.0.0.1:8176/variables/123


So, I've attempted this from the scripting tutorial for Indigo 7:
Code: Select all
indigohost -i
Code: Select all
indigo.variable.updateValue(1234567890, value=myAsciiString)

Unfortunately, I get a "Segmentation fault: 11" error each time I attempt this -- regardless of the variable ID I am trying to update.

Any suggestions/guidance on this?

Thanks in advance!

Posted on
Tue Apr 18, 2017 9:01 am
jay (support) offline
Site Admin
User avatar
Posts: 15683
Joined: Mar 19, 2008
Location: Austin, Texas

Re: AppleScript "Application isn't running" (-600) Errors

Are you just testing the command? You can open an interactive shell using the Plugins->Open Scripting Shell menu item.

Not sure why you're getting the segmentation fault, unless maybe your indigohost alias is pointing to Indigo 6 and you're running an Indigo 7 server (or vice versa).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Apr 19, 2017 7:44 pm
chobo offline
Posts: 109
Joined: Dec 08, 2013
Location: USA

Re: AppleScript "Application isn't running" (-600) Errors

Thanks for the reply here, Jay. Tested this via the built-in "Open Scripting Shell" command and here is the result:

Code: Select all
>>> indigo.variable.updateValue(1234567890, value=test)
/Applications/Indigo 7.app/Contents/PlugIns/launch_indigopluginhost.command: line 5: 19244 Segmentation fault: 11  /Library/Application\ Support/Perceptive\ Automation/Indigo\ 7/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost -i
logout

Other ideas on this one? Running 10.9.5, Indigo 7.0.3, and Python 2.7.5

Thx!

Posted on
Wed Apr 19, 2017 8:21 pm
jay (support) offline
Site Admin
User avatar
Posts: 15683
Joined: Mar 19, 2008
Location: Austin, Texas

Re: AppleScript "Application isn't running" (-600) Errors

Rerun the Indigo 7 installer - seems like you probably have a corrupt install.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Apr 19, 2017 8:42 pm
chobo offline
Posts: 109
Joined: Dec 08, 2013
Location: USA

Re: AppleScript "Application isn't running" (-600) Errors

jay (support) wrote:
Rerun the Indigo 7 installer - seems like you probably have a corrupt install.


Unfortunately, just reinstalled 7.0.3 and getting the same "segmentation fault" error. After a little Googling, could it be a bug within Python 2.7.5?

Posted on
Thu Apr 20, 2017 9:17 am
jay (support) offline
Site Admin
User avatar
Posts: 15683
Joined: Mar 19, 2008
Location: Austin, Texas

Re: AppleScript "Application isn't running" (-600) Errors

Have you installed a different version of python (like using homebrew)? That has definitely caused issues for other users.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Apr 20, 2017 4:01 pm
chobo offline
Posts: 109
Joined: Dec 08, 2013
Location: USA

Re: Calling IndigoPluginHost from an AppleScript

jay (support) wrote:
Have you installed a different version of python (like using homebrew)? That has definitely caused issues for other users.


Good thinking, Jay. Fully uninstalled the non-system version of Python and this part of the problem has been resolved. Thanks for the tip!

Posted on
Thu Apr 20, 2017 4:17 pm
chobo offline
Posts: 109
Joined: Dec 08, 2013
Location: USA

Re: Calling IndigoPluginHost from an AppleScript

With the Python error resolved, on to the real subject of the thread:
Calling IndigoPluginHost from an AppleScript.

Here’s where I am:
Message received in Apple Mail > Rule Triggered > Run AppleScript > Update variable via CURL/RESTful API. This works fine, but I would prefer using Indigo Plugin Host to achieve this.

Here’s where I would like to be:
Message received in Apple Mail > Rule Triggered > Run AppleScript > Update variable via call to Indigo Plugin Host (detail below)

This is working via Terminal and Indigo’s scripting shell:

Code: Select all
$ indigohost -i
>>> indigo.variable.updateValue(1234567890, value=“test”)

After much research and tinkering, I can’t seem to combine the two into a “do shell script” command in AppleScript. I’ve also tried executing an external Python Script using indigohost -x, but no luck.

Can this be done? If so, what might I be missing?

Thanks in advance!
Last edited by chobo on Thu Apr 20, 2017 9:44 pm, edited 1 time in total.

Posted on
Thu Apr 20, 2017 4:27 pm
jay (support) offline
Site Admin
User avatar
Posts: 15683
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Calling IndigoPluginHost from an AppleScript

Glad you figured out the segmentation fault problem.

You have to specify full path names to commands when you use do shell script in AppleScript because there's no (reliable) environment to get paths from. This should work:

Code: Select all
# specify the full path to the IndigoPluginHost command
set pathToIndigoHostApp to "/Library/Application\\ Support/Perceptive\\ Automation/Indigo\\ 7/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost"
# specify the script you're going to send to the plugin host process
set updateScript to "indigo.variable.updateValue(1234567890, value=\"test\")"
# run it
do shell script pathToIndigoHostApp & " -e '" & updateScript & "'"


Getting the quotes right is a bit tricky so when you modify the script above just be careful. Ultimately, this is the command that you want to perform in the shell (it's long so you'll have to scroll to see it all):

Code: Select all
/Library/Application\ Support/Perceptive\ Automation/Indigo\ 7/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost -e 'indigo.variable.updateValue(1234567890, value="test")'

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Apr 20, 2017 9:24 pm
chobo offline
Posts: 109
Joined: Dec 08, 2013
Location: USA

Re: Calling IndigoPluginHost from an AppleScript

Code: Select all
# specify the full path to the IndigoPluginHost command
set pathToIndigoHostApp to "/Library/Application\\ Support/Perceptive\\ Automation/Indigo\\ 7/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost"
# specify the script you're going to send to the plugin host process
set updateScript to "indigo.variable.updateValue(1234567890, value=\"test\")"
# run it
do shell script pathToIndigoHostApp & " -e '" & updateScript & "'"

Above is working perfectly. Thank you for turning something extremely frustrating into something fairly easy to understand. The key being: AppleScript lacks a reliable environment to get paths from — would have been great to know that at the beginning. Thx again!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest