I've just started using EventGhost, and want to know if I can send command line parameters to a macro program's command line?
So something like this:
Eventghost -e Program1 [COMMANDLINEPARAMS]
would trigger my Program1 event, which launches the program with the attached [COMMANDLINEPARAMS]
is there a wildcard I can put under Command line Parameters in the Start Program Application that would pass these along?
Send Command line parameters to a Macro Program?
-
- Posts: 18
- Joined: Sun Jul 19, 2009 7:58 pm
Re: Send Command line parameters to a Macro Program?
From EG documentation
Example: (copy & paste into EG to test)
Then in cmdline run a command:
EventGhost.exe -e myevent "Hello World!"
I am referencing eg.event.payload[0] instead of eg.event.payload because the payload is a tuple containing all the parameters, so if you run:
EventGhost.exe -e myevent Hello World! <---- note, Parameters not in quotes
Then you will get eg.event.payload[0] = 'Hello' and eg.event.payload[1] = 'World!'
Hopefully this helped..
-jinxdone
So this means that you can access the parameters in EG with the eg.event.payload variable in your macros and actions.-event <eventname> [<payload> ...]
Issues the event <eventname> in the currently running EventGhost instance. Optionally you can specify one or more <payload> strings, that will be added to the event in the eg.event.payload field.
-e <eventname> [<payload> ...]
Shorter alias for the -event option.
Example: (copy & paste into EG to test)
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="851">
<Macro Name="Show OSD: Message of the day is: {eg.event.payload}" Expanded="True">
<Event Name="myevent" />
<Action>
EventGhost.ShowOSD(u'Message of the day is: {eg.event.payload[0]}', u'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Arial', (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, False)
</Action>
</Macro>
</EventGhost>
EventGhost.exe -e myevent "Hello World!"
I am referencing eg.event.payload[0] instead of eg.event.payload because the payload is a tuple containing all the parameters, so if you run:
EventGhost.exe -e myevent Hello World! <---- note, Parameters not in quotes
Then you will get eg.event.payload[0] = 'Hello' and eg.event.payload[1] = 'World!'
You lost me there on what you are trying to do, but if I understood you correctly just stick the {eg.event.payload[0]} in your start application action parameters and it should work.Eventghost -e Program1 [COMMANDLINEPARAMS]
would trigger my Program1 event, which launches the program with the attached [COMMANDLINEPARAMS]
is there a wildcard I can put under Command line Parameters in the Start Program Application that would pass these along?
Hopefully this helped..
-jinxdone
-
- Posts: 18
- Joined: Sun Jul 19, 2009 7:58 pm
Re: Send Command line parameters to a Macro Program?
That seems to work, but I'm running into another problem:
I have an emulator in eventghost, say nes.exe (with event called nes)
If I run eventghost -e nes "C:\file.ext"
it works perfectly.
If I move the file to a complex directory, say Program Files, and run
eventghost -e nes "C:\Program Files\file.ext"
it doesn't work.
If I run the executable by itself, with the same params
nes.exe "C:\Program Files\file.ext"
it works without a problem.
Any reason why complex directories wouldn't work?
I have an emulator in eventghost, say nes.exe (with event called nes)
If I run eventghost -e nes "C:\file.ext"
it works perfectly.
If I move the file to a complex directory, say Program Files, and run
eventghost -e nes "C:\Program Files\file.ext"
it doesn't work.
If I run the executable by itself, with the same params
nes.exe "C:\Program Files\file.ext"
it works without a problem.
Any reason why complex directories wouldn't work?
-
- Posts: 18
- Joined: Sun Jul 19, 2009 7:58 pm
Re: Send Command line parameters to a Macro Program?
Disregard the last post, I merely had to put quotes around the {eg.event.payload[0]}, everythings working fine now, thanks for the help!
-
- Posts: 9
- Joined: Tue Jul 28, 2009 4:53 am
Re: Send Command line parameters to a Macro Program?
Yeah, some programs require a directory containing a space (Program Files) to be put into string format by using quotes.
-
- Posts: 48
- Joined: Sat May 25, 2013 12:10 pm
- Location: Toronto, Canada
Re: Send Command line parameters to a Macro Program?
Thanx,
Steve
Win10 Pro - 2004 - 64bit i7-4771 3.50GHz 32GB RAM 60TB Storage
EG - 0.5.0rc6, FileBot - 4.9.1.0, VidCoder 5.21
USBIRT, O-MEGA, DirWatcher, Keyboard, VLC
MediaPortal ...et al.
Steve
Win10 Pro - 2004 - 64bit i7-4771 3.50GHz 32GB RAM 60TB Storage
EG - 0.5.0rc6, FileBot - 4.9.1.0, VidCoder 5.21
USBIRT, O-MEGA, DirWatcher, Keyboard, VLC
MediaPortal ...et al.