Pulling variables from HTTP webserver

If you have a question or need help, this is the place to be.
Post Reply
eli2k
Posts: 26
Joined: Mon Jun 29, 2009 10:34 pm

Pulling variables from HTTP webserver

Post by eli2k » Tue Sep 26, 2017 12:47 am

I'm building a remote to control actions on a PC through the webserver component. Rather than making a bunch of macros for each HTTP.command, I noticed that I can use HTTP.* to capture every HTTP event. Can I extract what is in the * portion in order to make the programming in Python easier? I could not figure out how to turn that wildcard into a variable that I can use later. Thank you.
setup: windows 7 + EventGhost 0.5.0-rc4 + Intel nuc6i5syh

User avatar
Boolean263
Plugin Developer
Posts: 84
Joined: Sat Aug 12, 2017 7:52 pm
Location: Ottawa, Canada
Contact:

Re: Pulling variables from HTTP webserver

Post by Boolean263 » Tue Sep 26, 2017 1:43 am

You can access the `eg.event` object from Python to get more information about the event that triggered your macro/action. To answer your direct question, everything after the "HTTP." can be found in `eg.event.suffix`.

I tried to document it all on this wiki page; please let me know if you still have questions, because it'll help me figure out what needs to be added.

Good luck!
Windows 10 Home, version 1703, build 15063.540 · EventGhost 0.5.0-rc4 · wxPython 3.0.2.0
Python programmer for fun and profit. Dabbler in EventGhost plugin writing. Wiki gardener. General geek.

eli2k
Posts: 26
Joined: Mon Jun 29, 2009 10:34 pm

Re: Pulling variables from HTTP webserver

Post by eli2k » Tue Sep 26, 2017 1:51 am

Boolean263 wrote:
Tue Sep 26, 2017 1:43 am
You can access the `eg.event` object from Python to get more information about the event that triggered your macro/action. To answer your direct question, everything after the "HTTP." can be found in `eg.event.suffix`.

I tried to document it all on this wiki page; please let me know if you still have questions, because it'll help me figure out what needs to be added.

Good luck!
Thanks! I ran across the old webserver page (www.eventghost.net/mediawiki/index.php?title=Webserver) and couldn't find anything beyond how to use the webserver component.

I'll take a look at it what you posted. I was just doing some searching before seeing this, and found someone talking about eg.event.payload. I found I could formulate a URL like index.htm?Control&Stop, and EG would capture every Control event into one macro, and I could use eg.event.payload[0] to get that first argument/parameter, which is Stop, and from there I could do whatever I want with it.

I was planning to have that one macro house every command and what to do inside one python script and do actions depending on which application is active. Do you think that will be slower than making a separate macro for each command?
setup: windows 7 + EventGhost 0.5.0-rc4 + Intel nuc6i5syh

Post Reply