Author Topic: Setting Multiple Results  (Read 2767 times)

0 Members and 1 Guest are viewing this topic.

DHHJ

  • $upporter
  • Contributor
  • *****
  • Posts: 62
  • Karma: 1
    • View Profile
Setting Multiple Results
« 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?

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Setting Multiple Results
« Reply #1 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)

TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

DHHJ

  • $upporter
  • Contributor
  • *****
  • Posts: 62
  • Karma: 1
    • View Profile
Re: Setting Multiple Results
« Reply #2 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?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Setting Multiple Results
« Reply #3 on: September 01, 2014, 11:47:44 AM »
No thanks.  There is already a perfectly good example.