ActionResult

From VoxCommando
Jump to: navigation, search

(more documentation to come ...)

In the Python plugin, when you use vc.callAction it will return an object of type actionResult.

actionResult object

The actionResult class has the following properties and methods which you can read

Properties

strResult

string strResult

  • (The result of the action if any)
  • Similar to VC variable {LastResult}.

example: (to print the system volume)

myActionRes = vc.callAction("Sound.GetVol","",None)
print "The current system volume is: "+ myActionRes.strResult

strInfo

string strInfo

  • (Some actions don't return a result but still provide some information about their success / errors)

Methods

isError()

bool isError()

  • Returns false if the action completed successfully, or true if there was an error

example: (running this code in the python plugin window will result in the word "hello" being displayed in the OSD and the python log will have the line "ya baby" added to it.

myActionRes = vc.callAction("OSD.ShowText","Hello",None)
if myActionRes.isError():
    print "oops!  Something went wrong there."
else:
    print "ya baby"

toString()

string toString() (Returns the action's result, info, or error depending on what happened) This method will only be available in VoxCommando version 2.0.1.0 or later