Programatically execute action group

Forum rules

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo

Posted on
Tue Jul 19, 2011 1:42 pm
alistair offline
Posts: 109
Joined: Jul 14, 2006

Programatically execute action group

Hi

Anyone know how I can programatically execute a named action group from within my plugin?

-Alistair

Posted on
Tue Jul 19, 2011 1:56 pm
jay (support) offline
Site Admin
User avatar
Posts: 18245
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Programatically execute action group

We haven't completed actions and action groups in the IOM yet, but we will by GM. Most likely it will be something like this:

Code: Select all
indigo.actionGroup.execute(actionGroupRef)


It won't be in the beta update that we'll release this week - not sure when it'll get in exactly.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jul 19, 2011 1:59 pm
alistair offline
Posts: 109
Joined: Jul 14, 2006

Re: Programatically execute action group

OK. For now, I can make a web services call back out to IWS - and I'll update that section of code later ;)

Posted on
Tue Jul 19, 2011 2:22 pm
jay (support) offline
Site Admin
User avatar
Posts: 18245
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Programatically execute action group

You can also use the subprocess python module to execute an AppleScript:

Code: Select all
import subprocess
subprocess.call(["osascript","-e", 'tell application "IndigoServer" to execute group "Action Group Name"'])


That should work temporarily... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jul 19, 2011 2:27 pm
alistair offline
Posts: 109
Joined: Jul 14, 2006

Re: Programatically execute action group

Great - thanks for the tip! :)
The downside, is that I'm getting the DB reference of my action group from Indigo, and I can't find a way to turn it back into a name. Any workarounds?

Posted on
Tue Jul 19, 2011 3:30 pm
jay (support) offline
Site Admin
User avatar
Posts: 18245
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Programatically execute action group

Fortunately if you're getting a real actionGroup object, then just reference it's name (that much is implemented in the IOM):

Code: Select all
myGroup = indigo.actionGroups[1234]
myScript = u'tell application "IndigoServer" to execute group "' + myGroup.name + u'"'
subprocess.call(["osascript","-e", myScript])


So no workaround needed.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 24, 2011 7:33 pm
matt (support) offline
Site Admin
User avatar
Posts: 21421
Joined: Jan 27, 2003
Location: Texas

Re: Programatically execute action group

Note beta 9 (not yet available) will have a new function to execute Action Groups:

Code: Select all
indigo.actionGroup.execute(actionGroupRef)

Image

Posted on
Sun May 06, 2012 7:51 pm
alistair offline
Posts: 109
Joined: Jul 14, 2006

Re: Programatically execute action group

I'm finally taking advantage of this function - it seems to use name rather than reference.
I can't find it in the docs - is there a way to execute group by reference, rather than name?

Posted on
Sun May 06, 2012 7:54 pm
alistair offline
Posts: 109
Joined: Jul 14, 2006

Re: Programatically execute action group

Ah, the wonders of "grep" :)

I discovered that the call needs an "int" to work.... All solved!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest