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 do include payload as part of the trigger?
How do include payload as part of the trigger?
I am using Pako's Eventghost Forwarder for Growl. It forwards Growl for windows notifications to Eventghost. Only issue I am am having is that the created event's have a payload
Example of event: Main.Growl.EventGhost@App (u'Payload',)
When I drag the event to trigger a macro only this part is included: Main.Growl.EventGhost@App
How do I make it so I can trigger the macro based on what is included inside the payload: (u'Payload',)
Thanks in advance.
Example of event: Main.Growl.EventGhost@App (u'Payload',)
When I drag the event to trigger a macro only this part is included: Main.Growl.EventGhost@App
How do I make it so I can trigger the macro based on what is included inside the payload: (u'Payload',)
Thanks in advance.
Re: How do include payload as part of the trigger?
You can't use the payload directly to trigger a macro, you need to access the payload with for example a Python script.aldi13 wrote:How do I make it so I can trigger the macro based on what is included inside the payload: (u'Payload',)
Search the forum for "payload" and "trigger" (or just payload) and you should find some examples.
jonib
Re: How do include payload as part of the trigger?
Thanks for getting me started. I am having trouble figuring out how to write my script. I have been doing a lot of searching. Here is what I have which doesn't quite work:
Code: Select all
if eg.event.string = ("Main.Growl.EventGhost@App")
and eg.event.payload = ("Payload from event string")
then eg.TriggerEvent("My Event Name")Re: How do include payload as part of the trigger?
Try it like this :
Code: Select all
if eg.event.string == "Main.Growl.EventGhost@App" and eg.event.payload == "Payload from event string":
eg.TriggerEvent("My Event Name")Re: Including payload as part of a trigger
After the event triggers your script: my example from log SchedulGhost.TempEvent u"test"
this results in: Main.My Event Name
Code: Select all
if eg.event.string == "SchedulGhost.TempEvent":
if eg.event.payload == "test":
eg.TriggerEvent("My Event Name")Re: How do include payload as part of the trigger?
Hi.
What I┬┤m doing wrong here? No event is created

Thx!
EDIT: SOLVED! with eg.event.payload.title
What I┬┤m doing wrong here? No event is created

Code: Select all
if eg.event.string == "TaskMonitorPlus.Activated.chrome":
if eg.event.payload == "<title=u'Pleco Chinese Dictionary', window_class=u'Chrome_WidgetWin_1',...>":
eg.TriggerEvent("My Event Name")Thx!
EDIT: SOLVED! with eg.event.payload.title
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: How do include payload as part of the trigger?
@z3us
if you click on the help drop down in EG. then click on python shell. this is going to load a console for EG.
in that console is you look at the lower left you are going to see a tree control. this control contains all of the bits that are currently running in EG. you can navigate your way through this to see all of the different things.
but specifically we want to load the help for what gets set as the payload.
so in the pane at the top you will need to type in help(eg.UserPluginModule.TaskMonitorPlus.WindowInfo) when you are typing it will suggest auto complete options.
once you have that typed in press enter. the help information for that item is going to get printed out. what you are seeing is all of the available properties (variables that contain data) and methods (blocks of code that can be run) for a payload of an event that was generated by the Task Monitor Plus plugin. In this case it was very well documented on it's use. so you can read through and see what you have to do.
as an example i am going to show you one section of the output
the first line is the name of the method and the parameters that can be passed to it along with their default values.
the next line is a description of what the method does
then you will see a list if :param NAME: description
here you will see every parameter listed. the param is for parameter and the NAME will match one of the parameters used when you call the method and the description is a description of what that parameter does.
the line right after each one of those :param lines will be a :type NAME: line. this line tells you what kind of data the parameter takes. so bool would be a True/False and int would be an integer 1, 2, 3, 4, float is a decimal number str is a string "test string" and so on and so forth.
so if we used this command
eg.event.payload.Flash(self, caption=False, tray=True, times=10, speed=250)
this will not flash the window but it will flash the button on the start bar. it will flash it 10 times with 250 milliseconds between flashes
eg.event.payload.Flash(self, caption=True, tray=True, until_active=True)
this will flash the button and the window until you bring the window to the front
eg.event.payload.Flash(self, caption=False, tray=True, continuous=True)
this will flash the button until you call this command again with caption and tray set to False
this command will return (width, height) of the window
eg.event.payload.GetSizeTuple()
where as this one will return an object that you can access my using .Width and .Height the purpose for this one is you can pass the value returned by this directly to a wxPython control object or back to a different task monitor plus payload.
eg.event.payload.GetSize()
The payloads can be stored into eg.globals and can be used to check to see if the window is still open at a later point in time
and to check it later on
the task monitor plus plugin is a very powerful tool in the EG arsenal. you can control a vast amount of things with it.
if you click on the help drop down in EG. then click on python shell. this is going to load a console for EG.
in that console is you look at the lower left you are going to see a tree control. this control contains all of the bits that are currently running in EG. you can navigate your way through this to see all of the different things.
but specifically we want to load the help for what gets set as the payload.
so in the pane at the top you will need to type in help(eg.UserPluginModule.TaskMonitorPlus.WindowInfo) when you are typing it will suggest auto complete options.
once you have that typed in press enter. the help information for that item is going to get printed out. what you are seeing is all of the available properties (variables that contain data) and methods (blocks of code that can be run) for a payload of an event that was generated by the Task Monitor Plus plugin. In this case it was very well documented on it's use. so you can read through and see what you have to do.
as an example i am going to show you one section of the output
Code: Select all
Flash(self, caption=True, tray=False, until_active=False, continuous=False, times=10, speed=250)
| Flashes the caption or tray button for a duration.
| :param caption: Flash the caption
| :type caption: bool
| :param tray: Flash the tray
| :type tray: bool
| :param until_active: Flash until window is activated
| :type until_active: bool
| :param continuous: Keep flashing until stopped. To stop the
| flashing you need to call this method with caption and tray
| set to False
| :type continuous: bool
| :param times: The number of time to flash (not used if until_active
| or continuous is set)
| :type times: int
| :param speed: The duration of time between flashes in milliseconds
| :type speed: int
| :return: None
| :rtype: None
|
the next line is a description of what the method does
then you will see a list if :param NAME: description
here you will see every parameter listed. the param is for parameter and the NAME will match one of the parameters used when you call the method and the description is a description of what that parameter does.
the line right after each one of those :param lines will be a :type NAME: line. this line tells you what kind of data the parameter takes. so bool would be a True/False and int would be an integer 1, 2, 3, 4, float is a decimal number str is a string "test string" and so on and so forth.
so if we used this command
eg.event.payload.Flash(self, caption=False, tray=True, times=10, speed=250)
this will not flash the window but it will flash the button on the start bar. it will flash it 10 times with 250 milliseconds between flashes
eg.event.payload.Flash(self, caption=True, tray=True, until_active=True)
this will flash the button and the window until you bring the window to the front
eg.event.payload.Flash(self, caption=False, tray=True, continuous=True)
this will flash the button until you call this command again with caption and tray set to False
this command will return (width, height) of the window
eg.event.payload.GetSizeTuple()
where as this one will return an object that you can access my using .Width and .Height the purpose for this one is you can pass the value returned by this directly to a wxPython control object or back to a different task monitor plus payload.
eg.event.payload.GetSize()
The payloads can be stored into eg.globals and can be used to check to see if the window is still open at a later point in time
Code: Select all
eg.globals.some_window = eg.event.payload
Code: Select all
some_window = eg.globals.some_window
if some_window.IsAlive():
some_window.BringToTop()
some_window.Maximize()
some_window.Focus()
Re: How do include payload as part of the trigger?
Lots of thanks for your answer
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: How do include payload as part of the trigger?
no worries m8. its good information to have and the task monitor plus is an extremely powerful plugin.


