Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

How to capture event name as Python variable?

If you have a question or need help, this is the place to be.
Post Reply
therealbiglou
Experienced User
Posts: 126
Joined: Sat May 19, 2012 4:33 am

How to capture event name as Python variable?

Post by therealbiglou »

I'm not very versed in python and am having trouble capturing the name of an event as a variable in a python script. Below is the script I'm trying to use to send text to a popup box in WMC.

Code: Select all

from socket import socket, AF_INET, SOCK_DGRAM
data = 'Caption|Message Text|30'
port = 11000
hostname = '127.0.0.1'
udp = socket(AF_INET,SOCK_DGRAM)
udp.sendto(data, (hostname, port))
When I setup the IP, everything works perfectly. Now, I'm trying to get the event name to show up in the popup box. I've tried using {eg.event.payload} but it simply displays the literal string "{eg.event.payload}".

How do I set the variables in a python script? Thanks!
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: How to capture event name as Python variable?

Post by jonib »

therealbiglou wrote:How do I set the variables in a python script? Thanks!
Just use eg.event.payload in code as its a Python variable, the {} around are only needed within actions not in python code.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
Post Reply