kw123 wrote:i don't think you can from outside indigo start something inside indigo.
Actually, you can just use the IndigoPluginHost to execute a script. Start by
creating the indigohost alias (I put that in my .profile so it's always available).
Next, take a look at the args for indigohost:
- Code: Select all
FatBook:~ jay$ indigohost --help
Allowed options:
--help show this help message
-f [ --folder ] arg target plugin folder name (default arg)
-i [ --interactive ] run in interactive shell mode
-d [ --debug_mode ] arg (=0) debugging mode selector
-e [ --emb_script ] arg execute arg as embedded script source
-x [ --ext_script ] arg execute the target file path arg as an external
script
-p [ --port ] arg (=1176) indigo server port number
Next, just call it with your script using the
-e option:
- Code: Select all
indigohost -e 'indigo.actionGroup.execute(17622409777)'
Which you can call from a bash script if you want. Note, you can also use this with the
-x option to execute an Indigo Python script in a different file (see the args above).
If we had some more context, we might be able to make it even easier...
Advanced TipOne more cool thing that I don't think is mentioned anywhere else: if you want an Indigo python script to be executable from a shell by changing it's mode to executable, you can do that too. First, create a link to a path that does not contain spaces. I put it:
- Code: Select all
ln -s /Library/Application\ Support/Perceptive\ Automation/Indigo\ 7/IndigoPluginHost.app /usr/local/bin/IndigoPluginHost.app
This creates a path without spaces, which is important for the shebang to work at the top of an Indigo Python script. Add it:
- Code: Select all
#!/usr/local/bin/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost -x
to the top of the script, make the script executable, and it will now behave like any other unix command. For instance, I have this script:
- Code: Select all
#!/usr/local/bin/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost -x
from time import sleep
indigo.server.log("Starting script")
for i in range(20, 0, -1):
indigo.server.log("countdown: {}".format(i))
sleep(1)
saved in ~/jay/Projects/Indigo Scripts/simple_sleep.py. I changed it so that it's executable:
- Code: Select all
chmod +x ~/Projects/Python/Indigo/simple_sleep.py
so now I can just do:
- Code: Select all
FatBook:Indigo jay$ ./simple_sleep.py
to run the script. This is useful for other utilities that may require you to specify a single unix command.