Page 2 of 2

Re: Controlling Indigo from Command Line (or .py files)

PostPosted: Wed Jun 01, 2016 12:15 pm
by FlyingDiver
I'm not sure what you find inelegant about using an Action Group to accomplish what you're doing. Other than the fact it appears you're doing most of your system control in Python scripts that are not, in fact, part of Indigo. They're just started up by Indigo when needed. If it was me, I'd be trying to figure out how to make the system more integrated with Indigo, not less. But that's just me. In any case, Jay already pointed out the solution to the executable path issue you were having.

Re: Controlling Indigo from Command Line (or .py files)

PostPosted: Fri Jun 03, 2016 8:22 am
by RedYuriPrime
OK, making some progress.
Having correctly con figured .bash_profile and .bashrc to set up the alias, I can no run in Terminal a .py file under the IPH. As an example:

Last login: Fri Jun 3 14:49:38 on ttys000
Geoffs-Mac-mini:~ geoff$ indigohost -x /Users/geoff/Documents/Indigo/ActivePython/TestEasyDAC.py
Geoffs-Mac-mini:~ geoff$


However, putting the same line:
indigohost -x /Users/geoff/Documents/Indigo/ActivePython/TestEasyDAC.py
into a .py file and then running this within Indigo gives the following error:-

Script Error Core.py: global name 'indigohost' is not defined
Script Error Exception Traceback (most recent call shown last):

Core.py, line 68, at top level
NameError: global name 'indigohost' is not defined

So I must still be missing something.

Re: Controlling Indigo from Command Line (or .py files)

PostPosted: Fri Jun 03, 2016 9:40 am
by FlyingDiver
That's because the aliases you set up in your .bash_profile and .bashrc files are not available to scripts running from Indigo.

Just put the complete path name in your script as:

Code: Select all
/Library/Application\ Support/Perceptive\ Automation/Indigo\ 6/IndigoPluginHost.app/Contents/MacOS/indigohost -x /Users/geoff/Documents/Indigo/ActivePython/TestEasyDAC.py

Re: Controlling Indigo from Command Line (or .py files)

PostPosted: Mon Jun 06, 2016 2:19 am
by RedYuriPrime
Thanks Joe. However have tried the format you and Jay provided, and unfortunately it doesn't work, giving:

Script Error Core.py: invalid syntax
Script Error around line 83 - "/Library/Application\ Support/Perceptive\ Automation/Indigo\ 6/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost -x /Users/geoff/Documents/Indigo/ActivePython/TestEasyDAC.py"

Have resorted to the following; it does seem to work, although I do need to do further testing:
###
import subprocess

def rRun(module):
host ="/Library/Application Support/Perceptive Automation/Indigo 6/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost"
switch ="-x"
modulePath="/Users/geoff/Documents/Indigo/ActivePython/" + module
subprocess.Popen([host,switch,modulePath])

rRun("TestEasyDAC.py")
###

Will update in a few days to confirm if there are any unexpected side effects.

Regards,
Geoff

Re: Controlling Indigo from Command Line (or .py files)

PostPosted: Fri Jun 17, 2016 2:41 am
by RedYuriPrime
OK, just an update to say that the above solution is stable and does the job. :D