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.

OSM - Trigger Events without OSM Prefix

If you have a question or need help, this is the place to be.
Post Reply
jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

OSM - Trigger Events without OSM Prefix

Post by jsonnabend »

First of all, sorry about posting this here. The "plugin support" forum didn't give me a "new topic" option.

I am playing with Pako's really nice On Screen Menu plugin. I'm trying to trigger events from it without the "OSM" prefix. Is that possible?

TIA

- Jeff
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: OSM - Trigger Events without OSM Prefix

Post by Pako »

Unfortunately this is not possible without the change made in the code.
I not understand, why you need it?
Can you explain - preferably with an example?

Pako
jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: OSM - Trigger Events without OSM Prefix

Post by jsonnabend »

I am hoping to trigger events from the OSM that are identical to events triggered elsewhere, using the OSM to emulate other events. For example, to spoof Keyboard.Numpad5, for example.

I've written a single event handler for the event OSM.* that strips the "OSM" and re-triggers the modified event. For example, I can have the OSM trigger OSM.Keyboard.Numpad5, and my OSM.* handler receives the event and triggers Keyboard.Numpad5.

- Jeff
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: OSM - Trigger Events without OSM Prefix

Post by Pako »

You can do it through action "Python command":
RemapEventPrefix.jpg
RemapEventPrefix.jpg (4.82 KiB) Viewed 2438 times
But I can add an option for setting of event prefix.
Pako
jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: OSM - Trigger Events without OSM Prefix

Post by jsonnabend »

That's essentially what I've done, but using a Python script instead (I prefer scripts over one line commands).

Also, you should note that the command you listed won't work -- it adds the "keyboard" prefix to all events. Instead, I've written a Python script that strips the "OSM" event prefix, takes the next event string element as the new prefix, and what's left as the event.

Code: Select all

import sys
print "event=" + eg.EventString
newEvent=eg.EventString.split('.', 2)[-1]
newPrefix=eg.EventString.split('.', 2)[-2]
print "newPrefix=" + newPrefix + " NewEvent=" + newEvent
if newPrefix=="OSM":
    print "newPrefix is OSM.  Not re-triggering event."
    sys.exit(0)
eg.TriggerEvent(newEvent, prefix=newPrefix)
- Jeff
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: OSM - Trigger Events without OSM Prefix

Post by Pako »

Well, I made some improvements to plugin.
See OSM topic.
I please you to check and possible correction of my poor English in the help string and in Tooltip string!
Thanks, Pako
jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: OSM - Trigger Events without OSM Prefix

Post by jsonnabend »

Thanks for your continuing work on the great OSM plugin. I will check out the new features soon.

I am happy to check the English of the plugin (I take it the Czech is your first language, Python second, and English third ;) ).

- Jeff
Post Reply