Catching and Redirecting Events

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
liquid8
Posts: 35
Joined: Thu Feb 19, 2009 4:20 am

Catching and Redirecting Events

Post by liquid8 » Fri Aug 28, 2009 3:36 pm

Is it possible to catch events from other plugins from within your own plugin? Basically, I want to catch all events that occur, and redirecting them elsewhere.

If not, I guess I will create a Redirect macro in my plugin, with an action called 'Redirect'. The user would then need to drag any events they want redirected to my plugin into that macro. This would mimic the functionality I want above. The benefit of this is the user gets to decide what events would be redirected. The con is now the plugin requires more manual configuration to work the way I want.


Thanks.

stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Catching and Redirecting Events

Post by stottle » Fri Aug 28, 2009 3:39 pm

I don't believe there is a way, within a plugin, to request events. I think you are stuck with the macro option.

Brett

Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Catching and Redirecting Events

Post by Bartman » Fri Aug 28, 2009 3:48 pm

you can bind to events

Code: Select all

eg.Bind("event name pattern", callback)
But it does not sound like a wise idea. What should the plugin do?

liquid8
Posts: 35
Joined: Thu Feb 19, 2009 4:20 am

Re: Catching and Redirecting Events

Post by liquid8 » Fri Aug 28, 2009 4:29 pm

So you can bind events with a pattern, like the plugin prefix?

I am writing an Android EventGhost client. What I would like to do is catch events in the server, such as the keyboard events, or other (unknown) plugin events, and act on them with my plugin. The plugin will be similar to the Network Event Sender plugin, but instead of generating it's own events, or having to manually type in the events, it will just redirect existing ones to the Android client. The client will then be able to act on the incoming events, and perform its own actions.

stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Catching and Redirecting Events

Post by stottle » Fri Aug 28, 2009 4:44 pm

I don't think eg.Bind does what you want. You bind a function/method to a string, then call eg.Notify("myString") to call the action. It doesn't get the events you see in the log, only stuff from eg.Notify.

Brett

Post Reply