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.

Detecting base event from "HTTP.channel=505 []"

If you have a question or need help, this is the place to be.
Post Reply
zogg
Posts: 7
Joined: Wed Feb 24, 2016 11:43 pm

Detecting base event from "HTTP.channel=505 []"

Post by zogg »

Hello,

I have a simple web page running on the web server plugin that has an HTML input field, where I'm trying to get a channel number to pass to a command line program. With the web page I can submit the value and get an event in my EG log such as "HTTP.channel=505 []".

However, I can't figure out how to get EG to recognize just the "HTTP.channel" part of the event to execute a macro. Ideally I want to get the channel number as the payload to pass to the Windows command line.

I've tried variations of "HTTP.channel*" but nothing works. Any guidance here would be much appreciated.

Thanks!
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Detecting base event from "HTTP.channel=505 []"

Post by jonib »

zogg wrote: However, I can't figure out how to get EG to recognize just the "HTTP.channel" part of the event to execute a macro. Ideally I want to get the channel number as the payload to pass to the Windows command line.
You need to use a Python command/script action and test for a partial event suffix, search the forum for event and suffix and you should get some ideas how to do it.
I've tried variations of "HTTP.channel*" but nothing works. Any guidance here would be much appreciated.
The '*' only works for the last complete part (after the last period) so "HTTP.*" would work (but not for you of course)

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
zogg
Posts: 7
Joined: Wed Feb 24, 2016 11:43 pm

Re: Detecting base event from "HTTP.channel=505 []"

Post by zogg »

jonib wrote:
zogg wrote: However, I can't figure out how to get EG to recognize just the "HTTP.channel" part of the event to execute a macro. Ideally I want to get the channel number as the payload to pass to the Windows command line.
You need to use a Python command/script action and test for a partial event suffix, search the forum for event and suffix and you should get some ideas how to do it.
I've tried variations of "HTTP.channel*" but nothing works. Any guidance here would be much appreciated.
The '*' only works for the last complete part (after the last period) so "HTTP.*" would work (but not for you of course)

jonib
Thanks for the help. After posting this I was thinking it was probably going to take a Python script to do the job, so you have confirmed that.

Would the script need to go into a particular section such as Autostart, or just in any active Macro?
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Detecting base event from "HTTP.channel=505 []"

Post by jonib »

zogg wrote:Would the script need to go into a particular section such as Autostart, or just in any active Macro?
Just put it right after the event in the same macro or it wont have access to the event information.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
zogg
Posts: 7
Joined: Wed Feb 24, 2016 11:43 pm

Re: Detecting base event from "HTTP.channel=505 []"

Post by zogg »

jonib wrote:
zogg wrote:Would the script need to go into a particular section such as Autostart, or just in any active Macro?
Just put it right after the event in the same macro or it wont have access to the event information.

jonib
Thanks again. Once I figured out that I could trigger my event with "HTTP.*", then a short Python script gives me the channel number to use:

Code: Select all

suffix = eg.event.suffix
chan = suffix.split("=")[-1]
print chan
Now I can build on this script as needed.
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Detecting base event from "HTTP.channel=505 []"

Post by jonib »

zogg wrote:Now I can build on this script as needed.
Very nice, as a bonus

Code: Select all

{eg.event.suffix.split("=")[-1]}
You can put this directly in many actions, in their settings (depending if the action supports it), so you don't always need a Python script for shorter commands.
Like the "Start a program" action supports it.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
zogg
Posts: 7
Joined: Wed Feb 24, 2016 11:43 pm

Re: Detecting base event from "HTTP.channel=505 []"

Post by zogg »

jonib wrote:Very nice, as a bonus

Code: Select all

{eg.event.suffix.split("=")[-1]}
You can put this directly in many actions, in their settings (depending if the action supports it), so you don't always need a Python script for shorter commands.
Like the "Start a program" action supports it.

jonib
Bonus indeed, that is exactly what I've been looking for and now my macro is perfect. Thanks again jonib!
Post Reply