Hi.
I only recently started using EventGhost, and I'm loving it so far, but I'm not too familiar with it yet, and so I have a question about payloads and how to utilize them:
When I turn on my TV, which is connected to my PC via HDMI, I would like EventGhost to start up XBMC for me.
When the TV is turned on EG registers an event with a payload (System.DeviceAttached [u'\\\\?\\DISPLAY#KTC1995#5&26eb435d&0&UID259#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}']).
I tried to drag & drop this event to the XBMC-startup-macro, but it didn't add the payload, only the event name.
This does work, however it also makes XBMC start up whenever I connect something else to my PC, like my android phone or a memory stick.
I tried adding the payload in the trigger event manually, but then nothing happens...
Anyone able to help?
Thanks!
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.
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 use payloads?
Re: How to use payloads?
I think you need to create a python script under the action with an if-then statement, something like
if: eg.event.payload == X:
start your program command
else:
eg.Exit() #which means exit this macro right now...
if: eg.event.payload == X:
start your program command
else:
eg.Exit() #which means exit this macro right now...
Re: How to use payloads?
Thanks man. 
It didn't quite do the trick, I think maybe it was because the payload was so messed up. But you set me on the right path, with my very limited programming skills and zero experience with python it was very helpful.
Found eventually out that I had to use the in operator to search the payload for some unique content.
find_this = "KTC1995"
if find_this in str(eg.event.payload):
print "success!"
else:
print "not found"
It didn't quite do the trick, I think maybe it was because the payload was so messed up. But you set me on the right path, with my very limited programming skills and zero experience with python it was very helpful.
Found eventually out that I had to use the in operator to search the payload for some unique content.
find_this = "KTC1995"
if find_this in str(eg.event.payload):
print "success!"
else:
print "not found"
Re: How to use payloads?
viewtopic.php?f=5&t=2839&start=15#p23032 has an .xml with a couple of ways of doing what you want too.
Re: How to use payloads?
the payload of this event is an array containing a string [u'something']
to get the string you have to to something like :
then you can match it like that :
to get the string you have to to something like :
Code: Select all
dev = eg.event.payload[0]
Code: Select all
if dev=="\\\\?\\DISPLAY#KTC1995#5&26eb435d&0&UID259#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}":
print "Got it !"
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
Re: How to use payloads?
Thank you so much guys, I got it working now, much appreciated. 