VoxCommando

Help and Support (Using VoxCommando) => Python Scripting => Topic started by: DHHJ on August 31, 2014, 02:11:41 PM

Title: Setting Multiple Results
Post by: DHHJ on August 31, 2014, 02:11:41 PM
Is there a way to pass more than one variable from a PY file back to VC?

For example, I can use:

result = 1.2345 in a Python script and when I return to the LCB, I can see "result" using:

OSD.ShowText {LastResult}

but what if I want to return 2 results, say res1 and res2?

I tried executing, in Python,

vc.callAction("Results.SetVar","res1","abcd") and also
res2 = "defg"

and then tried to access either of them in the LCB, using:
OSD.ShowText {var.res1} or
OSD.ShowText {var.res2}

Neither worked- I guess I'm looking for a kind of Results.GetVar action?
Title: Re: Setting Multiple Results
Post by: nime5ter on August 31, 2014, 03:12:20 PM
Your vc.callAction solution should work with the correct syntax.

As per the example from the other day, the parameters required by the VC action should not be comma separated, but should follow the same format as in the documentation:

http://voxcommando.com/mediawiki/index.php?title=Python#Actions

That is:  vc.callAction("NameofAction","param1&&param2&&param3&&param4&&param5&&param6etc.etc.",None)

Title: Re: Setting Multiple Results
Post by: DHHJ on September 01, 2014, 11:30:31 AM
Thx- got it now!    :bonk

I'd be happy to update the Python entry in the wiki- to provide an example or two. If that makes sense, can you set up my access privileges?
Title: Re: Setting Multiple Results
Post by: jitterjames on September 01, 2014, 11:47:44 AM
No thanks.  There is already a perfectly good example.