EG doesn't recognize soft (emulated) key presses

Found a bug in EventGhost? Report it here.
Post Reply
Chaemelion
Posts: 9
Joined: Tue Jul 28, 2009 4:53 am

EG doesn't recognize soft (emulated) key presses

Post by Chaemelion » Wed Jul 29, 2009 6:51 am

I don't know if you'd consider this a bug, but EG will not recognize emulated key press events generated by GlovePIE. Every other program recognizes it, EG itself will jump to anything beginning with the letter, and even keyboard lights come on but EG will not generate an event. This is getting me really frustrated. I've been looking into using OSC, MIDI, network packets, and even tried resorting to key presses to get GlovePIE to send commands to EG but nothing works :(

User avatar
jinxdone
Plugin Developer
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: EG doesn't recognize soft (emulated) key presses

Post by jinxdone » Wed Jul 29, 2009 7:31 am

Doesn't glovepie allow running programs? You can run "eventghost.exe -e event payload" to trigger events. I'd guess it'd also be possible to use the simple udp packet plugin(search the forum) or some of the other plugins to interface with EG to trigger events.

Chaemelion
Posts: 9
Joined: Tue Jul 28, 2009 4:53 am

Re: EG doesn't recognize soft (emulated) key presses

Post by Chaemelion » Wed Jul 29, 2009 9:02 am

I never knew that, but once again I run into a problem. I can give it the filepath for a file to run, but I cannot pass command line arguments with it... also, I dont see this plugin you were talking about...

Chaemelion
Posts: 9
Joined: Tue Jul 28, 2009 4:53 am

Re: EG doesn't recognize soft (emulated) key presses

Post by Chaemelion » Wed Jul 29, 2009 9:30 am

Actually, let me see if I can't include the arguments in a .bat file and run that... *crosses fingers*
Last edited by Chaemelion on Wed Jul 29, 2009 9:53 am, edited 2 times in total.

User avatar
jinxdone
Plugin Developer
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: EG doesn't recognize soft (emulated) key presses

Post by jinxdone » Wed Jul 29, 2009 9:41 am

I was referring to this plugin: http://www.eventghost.org/forum/viewtopic.php?f=9&t=724

It listens for udp broadcasts and triggers events. Those should be simpler to send than what the protocol for the normal network sender plugin requires. I'm not too familiar with glovepie though so I'm not sure which is the easiest to do with it.

Chaemelion
Posts: 9
Joined: Tue Jul 28, 2009 4:53 am

Re: EG doesn't recognize soft (emulated) key presses

Post by Chaemelion » Wed Jul 29, 2009 9:54 am

ah, I was searching for UDP. Anyhow, it worked! I'll have to make a batch file for each command, but it works flawlessly! Thanks so much :D

User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: EG doesn't recognize soft (emulated) key presses

Post by topix » Wed Jul 29, 2009 4:51 pm

Chaemelion wrote:I never knew that, but once again I run into a problem. I can give it the filepath for a file to run, but I cannot pass command line arguments with it... also, I dont see this plugin you were talking about...
You can pass command line arguments. They will be in the payload. Have a look at this macro:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1016">
    <Macro Name="Execute Command" Expanded="True">
        <Event Name="Main.CMD" />
        <Action>
            EventGhost.PythonScript(u'eg.globals.param = ""\nfor p in eg.event.payload[1:]:\n    eg.globals.param += \' \' + p\neg.plugins.EventGhost.ShowOSD(eg.event.payload[0]+" "+u\'{eg.globals.param}\', u\'0;-32;0;0;0;700;0;0;0;0;3;2;1;34;Arial\', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 5.0, False)\n\neg.plugins.System.Execute(eg.event.payload[0], eg.globals.param, 0, False, 2, u\'\')\n\n# to use spaces in paramters use triple quotes:\n# eventghost.exe -e MyEvent """C:\\users\\My Space""" some more options\n# => MyEvent "C:\\users\\My Space" some more options')
        </Action>
    </Macro>
</EventGhost>
With this macro you can start EG with the -e parameter to generate an event. All parameters after the eventname are then stored in the payload. In my above example macro i used as eventname CMD. My macro uses the first argument to my event as a program which should be started. All other arguments are arguments to this program. Confused? :o

Code: Select all

EventGhost.exe -e CMD notepad.exe """c:\program files\desktop.ini"""
EventGhost.exe -e CMD cmd /C dir """c:\program files""" /P /S
The first line will run Notepad with "c:\program files\desktop.ini" opened.
The second line runs CMD, which itself opens a new CLI and executes dir "c:\program files" /P /S.

The triple quotes in the above command lines are needed, because there are spaces in the filename. EG (Python) will translate them to single quotes when executing the macro.

Chaemelion
Posts: 9
Joined: Tue Jul 28, 2009 4:53 am

Re: EG doesn't recognize soft (emulated) key presses

Post by Chaemelion » Thu Jul 30, 2009 2:44 am

I understand, my problem was GLOVEPIE could execute applications, but it wont pass command line arguments with it. I could tell it to launch "EventGhost.exe" but it wouldnt run "EventGhost.exe -e Time.Query". What I had to do is combine the command and command line arguments into a single command, so I put them both together (EventGhost.exe -e Time.Query) into a windows batch file so Glovepie could run that and still include the arguments. Thanks for your help, my problem is solved. It doesn't matter to me anymore, but EG still doesn't create events for emulated key presses. Maybe it's being emulated too high up there for EG to see it... or perhaps it was done on purpose so EG wont recognize when IT is doing the emulating...

Post Reply