Python Scripting Tag Global Variables

  • On 15/07/2015 at 21:31, xxxxxxxx wrote:

    Hello Forum,

    After reading these great posts: Thanks Niklas. Thanks Sebastian.
    I realized there is much to learn about Python Scripting Tags.

    Where are the global variables for the Python Scripting Tags documented?
    By reading other posts/examples, I understand that "op" and "doc" are global variables, but I did knot know there was a global function like message(msg_type, data) : available in a scripting tag.

    I do not understand how message(msg_type, data) works in the scripting tag.  How is it getting called?  Is it like a virtual method in c++?  Are there other functions like this available?

    Thank you,

    Joe Buck

  • On 16/07/2015 at 02:03, xxxxxxxx wrote:

    Hi Joe,

    The Python documentation is currently lacking information on Python scripting features (tags, scripts, XPresso node etc).

    main() in a Python tag is the same as TagData::Execute() and the available global variables are:
    doc : the host document of the tag.
    flags : the execution flags.
    op : the Python tag.
    bt : the calling thread.
    tp : the TP master system for the host document if there's one.

    message(id, data) in a Python tag behaves the same as TagData::Message().
    It receives the data as Python dictionaries with the entries matching the names used in the C++ API for the structure members.
    The available global variables are the same as in main() except that flags and priority does not make sense in message().

  • On 16/07/2015 at 08:20, xxxxxxxx wrote:

    Thank you Yannick.  This is solved.

Log in to reply