Page 1 of 1

call a macro from an external soft

Posted: Sat Aug 15, 2009 12:18 pm
by emm456
Hi, I'm a newbie in EG. It's a fantastic automation software for me. I made a xml file with macros for all my HC elements (TVonoff, 1 channel, MuteVolume, AmpOnOff...) and X10 lights. It work perfectly. But I try now to make a software with a great graphic interface wich launch EG macros.

I made one but it's very long : my graphic soft launch an empty .exe applicaion, named "TVOnOFF.exe" wich open an empty window.
The macro have an event : "Task.Activated.TVOnOFF", a close instruction, and the IR action.

It's very long before the launch of the macro.

I tried to launch a .bat with "C:\Program Files\EventGhost\EventGhost.exe" -e TVOnOFF
exit

but it don't work.


I don't know the c++ and python languages but I tried to lern them.

Could you give me the entire code to launch my TVOnOFF macro with a .bat, a c++ or a python soft I could create with a graphic interface. Thanks a lot for all (and excuse my english, I'm french).

Re: call a macro from an external soft

Posted: Sat Aug 15, 2009 2:48 pm
by Bartman
The eventname for the macro has to be called

Code: Select all

Main.TVOnOFF
or just TVOnOFF.
You can also use the COM Interface of EventGhost

Re: call a macro from an external soft

Posted: Sat Aug 15, 2009 5:14 pm
by emm456
Hi. Thanks for your answer. I don't know what is the COM interface of EG ? But I think the code line you wrote is in EG. What I want is the code to call EG macros from an external application.

Re: call a macro from an external soft

Posted: Sat Aug 15, 2009 5:23 pm
by Bartman
You can create a COM Object in your application and call the function called TriggerEvent. Will be way faster than starting a whole process.

The code is just the name of the event. The events triggered from outside always have the prefix "Main" and therefore "Task.Activated.TVOnOFF" will not match. So nothing happens.
Make sure to uncheck the bottom left checkbox in EG and run your batch file again. You will see a "Main.TVOnOFF" entry in the log and can drag and drop that to you macro.

Re: call a macro from an external soft

Posted: Sat Aug 15, 2009 7:06 pm
by jitterjames
if you use the com object does the TriggerEvent function just take 1 string as the parameter?

i.e.

eventGhostNameSpaceWhatEverItIs.TriggerEvent("myEventName 'payload goes here' ");

would work?

Re: call a macro from an external soft

Posted: Sun Aug 16, 2009 2:20 pm
by emm456
OK thanks, I will see it if I can do it.

Thanks a lot. Bye.