call a macro from an external soft

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
emm456
Posts: 6
Joined: Wed Aug 05, 2009 5:03 am

call a macro from an external soft

Post by emm456 » Sat Aug 15, 2009 12:18 pm

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).

Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: call a macro from an external soft

Post by Bartman » Sat Aug 15, 2009 2:48 pm

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

emm456
Posts: 6
Joined: Wed Aug 05, 2009 5:03 am

Re: call a macro from an external soft

Post by emm456 » Sat Aug 15, 2009 5:14 pm

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.

Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: call a macro from an external soft

Post by Bartman » Sat Aug 15, 2009 5:23 pm

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.

User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: call a macro from an external soft

Post by jitterjames » Sat Aug 15, 2009 7:06 pm

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?

emm456
Posts: 6
Joined: Wed Aug 05, 2009 5:03 am

Re: call a macro from an external soft

Post by emm456 » Sun Aug 16, 2009 2:20 pm

OK thanks, I will see it if I can do it.

Thanks a lot. Bye.

Post Reply