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!
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.
Detecting base event from "HTTP.channel=505 []"
Re: Detecting base event from "HTTP.channel=505 []"
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.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.
The '*' only works for the last complete part (after the last period) so "HTTP.*" would work (but not for you of course)I've tried variations of "HTTP.channel*" but nothing works. Any guidance here would be much appreciated.
jonib
Re: Detecting base event from "HTTP.channel=505 []"
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.jonib wrote: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.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.
The '*' only works for the last complete part (after the last period) so "HTTP.*" would work (but not for you of course)I've tried variations of "HTTP.channel*" but nothing works. Any guidance here would be much appreciated.
jonib
Would the script need to go into a particular section such as Autostart, or just in any active Macro?
Re: Detecting base event from "HTTP.channel=505 []"
Just put it right after the event in the same macro or it wont have access to the event information.zogg wrote:Would the script need to go into a particular section such as Autostart, or just in any active Macro?
jonib
Re: Detecting base event from "HTTP.channel=505 []"
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:jonib wrote:Just put it right after the event in the same macro or it wont have access to the event information.zogg wrote:Would the script need to go into a particular section such as Autostart, or just in any active Macro?
jonib
Code: Select all
suffix = eg.event.suffix
chan = suffix.split("=")[-1]
print chanRe: Detecting base event from "HTTP.channel=505 []"
Very nice, as a bonuszogg wrote:Now I can build on this script as needed.
Code: Select all
{eg.event.suffix.split("=")[-1]}Like the "Start a program" action supports it.
jonib
Re: Detecting base event from "HTTP.channel=505 []"
Bonus indeed, that is exactly what I've been looking for and now my macro is perfect. Thanks again jonib!jonib wrote:Very nice, as a bonusYou 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.Code: Select all
{eg.event.suffix.split("=")[-1]}
Like the "Start a program" action supports it.
jonib
