Trigger event adds Main. in EG 0.5.0

Questions and comments specific to a particular plugin should go here.
Post Reply
Lilak
Posts: 34
Joined: Fri Dec 28, 2012 9:06 am
Location: Sweden

Trigger event adds Main. in EG 0.5.0

Post by Lilak » Tue Jan 30, 2018 6:37 pm

In EG 0.4.1."Trigger event" gave me this in the log: TellStickDuo.Soffa Knapp 2.OFF

In EG 0.5.0 I get this: Main.TellStickDuo.Soffa Knapp 2.OFF

Is there a way for me to get rid of Main., or do I have to change all of my macros that uses the old event? I have a lot of them, so I really would like to avoid that.

Best regards

Jonas

jachin99
Experienced User
Posts: 517
Joined: Sat Feb 13, 2016 8:39 pm

Re: Trigger event adds Main. in EG 0.5.0

Post by jachin99 » Thu Feb 01, 2018 3:09 am

That just looks like event prefix to me. Check the settings for your plugin and EG and see if you can change it.

Lilak
Posts: 34
Joined: Fri Dec 28, 2012 9:06 am
Location: Sweden

Re: Trigger event adds Main. in EG 0.5.0

Post by Lilak » Thu Feb 01, 2018 3:31 am

I can't find a setting for this.

There is two things to do in the plugin, you can type in an event string to fire (whatever I write here, EG adds Main. this didn't happen in EG 0.4.1), and you can add a delay.

Best regards

Jonas

User avatar
yokel22
Experienced User
Posts: 247
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Trigger event adds Main. in EG 0.5.0

Post by yokel22 » Thu Feb 01, 2018 12:08 pm

In eg 5.0 it adds the prefix Main to the trigger event action. There was some talk of adding a prefix parameter to the action. I believe Kgschlosser has this on the to do list. That still won't solve your problem though as even if you set it to nothing your going to still get the dot before the event suffix.

So, i think your going to need to change the events in your 5.0 tree.

Snowbird
Experienced User
Posts: 342
Joined: Fri Jul 03, 2009 10:04 am

Re: Trigger event adds Main. in EG 0.5.0

Post by Snowbird » Thu Feb 01, 2018 3:22 pm

If you want to get rid of the Main prefix then you have to use python script :

Code: Select all

eg.TriggerEvent(prefix="MyPrefix", suffix="MySuffix", payload='MyPayload')
# fire an event without the MAIN prefix
if you don't need the payload, just omit it.

Lilak
Posts: 34
Joined: Fri Dec 28, 2012 9:06 am
Location: Sweden

Re: Trigger event adds Main. in EG 0.5.0

Post by Lilak » Thu Feb 01, 2018 4:51 pm

Thank you guys, for information and possible solution.

It seems I have to make changes in my tree. My choice will be to make changes to the events.

Best regards

Jonas

User avatar
kgschlosser
Site Admin
Posts: 4176
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Trigger event adds Main. in EG 0.5.0

Post by kgschlosser » Sun Mar 11, 2018 8:15 am

For purposes of keeping everyone informed. (I missed this being posted.)

We have reworked the TriggerEvent action "eg.plugins.EventGhost.TriggerEvent" not "eg.TriggerEvent"

The retooling of the action served multiple purposes. One was to enforce a prefix, suffix standard. the reason why this has been chosen to be done is because of the ability to use wild carding when adding an event to a macro. It makes this process far easier to understand and also manage.

We have also added a couple of other goodies as well. One of the downsides of how EG works is that all events run in a single thread. what this means is any time TriggerEvent (action or eg) gets called the event gets added to the end of the list of events waiting to get processed. Because EG only allows for a single event and thus a single macro to get processed at a time this can prove to be problematic for some users that like to have a really organized tree. Now I know that you can use jumping to accomplish an organized tree. but if you want to pass data you would have to use eg.globals. and this is where the organization would go out the window. Macros can get overly complicated and you would have to do a lot of attribute checking or set all of the globals at the startup of EG. It can get quite messy when all you want to do is share a single bit of data and not store it for the long term.

So we have set up a means to allow for Events to get triggered real time. what this means is even tho there is an event that is running. you have the ability to cause another to run while the first is still running. The benefit to this is if you pass say a dictionary or a list as the event payload if the payload is modified in any way the macro that triggered the event would be able to access the new/modified data. This is because python lists and dicts are mutable. if you make a change, the change happens to all copies of it.

Which leads me to the next thing.. i did say payload with the TriggerEvent action.. yes we also added the ability to do payloads as well. with evaluating what is passed to it. so if you wanted to pass a global you can.

We also added the prefix as well. this does a little legwork so we don't end up with a blank prefix. so if there is no prefix entered then it checks the suffix. and if there is no "." in the suffix then it will automatically add Main as the prefix. if there is a "." then everything before it becomes the prefix. and the prefix and suffix entry also evaluate the data passed.

I have also written a whole help section that is in the section for how to use the various components of it.
If you like the work I have been doing then feel free to Image

stevep
Posts: 20
Joined: Tue Mar 13, 2018 7:46 am

Re: Trigger event adds Main. in EG 0.5.0

Post by stevep » Sat Mar 24, 2018 5:05 am

I added the Task Create/Switch Events plugin to my configuration. This helps me switch tabs on Firefox when it is already running. I noticed that with the plugin I see Main.Task.Activated.firefox. I assume the Main prefix is from the plugin -- true? To address the prior concern someone else had, the prefix does not interfere with the general Task.Activated.firefox event that is in my config. The trigger occurs with either version of the event. This means you do not have to rewrite a config to accommodate both versions. I like it.

BTW, I'm using EG 0.4.1.r1772

User avatar
kgschlosser
Site Admin
Posts: 4176
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Trigger event adds Main. in EG 0.5.0

Post by kgschlosser » Sat Mar 24, 2018 6:30 am

I am not 100% sure what you mean. the changes I am talking about are ones that are in a new version of EG that is being developed. and not in the 1722 version.

I am not sure why you are seeing the "Main." prefix if the event is generated by a plugin. the only time you should see that "Main." prefix is if you use the Trigger Event action and for a select few events that are generated by EG.
If you like the work I have been doing then feel free to Image

stevep
Posts: 20
Joined: Tue Mar 13, 2018 7:46 am

Re: Trigger event adds Main. in EG 0.5.0

Post by stevep » Sun Mar 25, 2018 8:40 am

The Main prefix started showing up after I added the Task Create plugin and started triggering events based upon an application, Firefox, becoming active. The Main prefix did not show up all the time though. I have moved to your latest eg version so I can't go back and check for more precise info.

Post Reply