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.

Can i specify a specific event to activate my macro?

If you have a question or need help, this is the place to be.
Post Reply
Boomslangnz
Posts: 2
Joined: Sat Jun 23, 2012 7:34 am

Can i specify a specific event to activate my macro?

Post by Boomslangnz »

Hi

is it possible to have IR codes blasted if i opened 123.bat but not for 122.bat

so only for that specific file etc? and not every bat file

thanks
Flyingsubs
Experienced User
Posts: 127
Joined: Sat Dec 29, 2012 11:26 pm

Re: Can i specify a specific event to activate my macro?

Post by Flyingsubs »

I don't think so. you have to do everything in eventghost. You can have it work by when you launch a .bat file it sends an IR signal.

-Flyingsubs
kalia
Experienced User
Posts: 109
Joined: Wed Aug 12, 2009 1:10 am

Re: Can i specify a specific event to activate my macro?

Post by kalia »

What does the .bat file look like?

You could add a similar line in the .bat file to trigger an event in EventGhost and use it in a macro to blast the IR code:

Code: Select all

"C:\Program Files (x86)\EventGhost\EventGhost.exe" -event BlastCode
kalia
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Can i specify a specific event to activate my macro?

Post by blaher »

kalia wrote:What does the .bat file look like?

You could add a similar line in the .bat file to trigger an event in EventGhost and use it in a macro to blast the IR code:

Code: Select all

"C:\Program Files (x86)\EventGhost\EventGhost.exe" -event BlastCode
kalia

Code: Select all

13:57:16: 1 MainThread: Named Pipe: Command: eg.TriggerEvent, Parameters:  (u'BlastCode',)
13:57:16: 0 EventGhost.Pipe.Thread: Named Pipe: return data: <eg.Classes.EventGhostEvent.EventGhostEvent object at 0x0AEEE3B0>
13:57:16: 0 EventGhost.Pipe.Thread: Named Pipe: Creating pipe
Traceback (most recent call last):
  File "EventGhost.pyw", line 53, in <module>
  File "C:\Program Files (x86)\EventGhost\eg\__init__.py", line 31, in <module>
    import Cli
  File "C:\Program Files (x86)\EventGhost\eg\Cli.py", line 172, in <module>
    'eg.TriggerEvent, %s' % str(args.startupEvent)
  File "C:\Program Files (x86)\EventGhost\eg\NamedPipe.py", line 253, in send_message
    return eval(data)
  File "<string>", line 1
    <eg.Classes.EventGhostEvent.EventGhostEvent object at 0x0AEEE3B0>
    ^
SyntaxError: invalid syntax
So what's the correct syntax now?
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Can i specify a specific event to activate my macro?

Post by kgschlosser »

you found a bug my friend. the syntax is the same. i didn't even think about how it works if there already isn't an EG instance running.

going to have to fix that
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Can i specify a specific event to activate my macro?

Post by kgschlosser »

that bug has been fixed if you see here.
viewtopic.php?f=12&t=9730

but there was also another issue as well which the file below fixes.

you will need to replace the eg\Classes\EventThread.py file with the attached one.

the syntax for using it is as follows

-event suffix "payload" prefix

i surround the payload with quotes because if you have any spaces in the payload it will have to be surrounded by quotes for it to work properly.
Attachments
EventThread.py
(4.67 KiB) Downloaded 68 times
If you like the work I have been doing then feel free to Image
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Can i specify a specific event to activate my macro?

Post by blaher »

It gives this error with the new file you attached:

Code: Select all

13:40:24: 0 EventGhost.Pipe.Thread: Named Pipe: Data received
13:40:24: 1 MainThread: Named Pipe: Command: eg.TriggerEvent, Parameters:  (u'yy',)
13:40:24: 0 EventGhost.Pipe.Thread: Named Pipe: return data: <eg.Classes.EventGhostEvent.EventGhostEvent object at 0x08C54B10>
13:40:24: 0 EventGhost.Pipe.Thread: Named Pipe: Creating pipe
Traceback (most recent call last):
  File "EventGhost.pyw", line 53, in <module>
  File "C:\Program Files (x86)\EventGhost\eg\__init__.py", line 31, in <module>
    import Cli
  File "C:\Program Files (x86)\EventGhost\eg\Cli.py", line 172, in <module>
    'eg.TriggerEvent, %s' % str(args.startupEvent)
  File "C:\Program Files (x86)\EventGhost\eg\NamedPipe.py", line 253, in send_message
    return eval(data)
  File "<string>", line 1
    <eg.Classes.EventGhostEvent.EventGhostEvent object at 0x08C54B10>
    ^
SyntaxError: invalid syntax
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Can i specify a specific event to activate my macro?

Post by kgschlosser »

OK it's going to because there are 2 errors taking place. so you need to change the file in the link i posted. as well as the one from here.. because the fix for one bug will cause the second to show it's ugly head. but if you replace both files then all will be good.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Can i specify a specific event to activate my macro?

Post by kgschlosser »

@blaher

I don't know if you realized this or not. But you were answering a post from 5 years ago. I just noticed that. LOL I have done it also. It is kinda funny tho. Better late then never?? :-D
If you like the work I have been doing then feel free to Image
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Can i specify a specific event to activate my macro?

Post by blaher »

kgschlosser wrote: so you need to change the file in the link i posted.
There's quite a few files on that page. Can you tell me which one is relevant, please?
I don't know if you realized this or not. But you were answering a post from 5 years ago. I just noticed that. LOL I have done it also. It is kinda funny tho. Better late then never?? :-D
Yeah, I knew because this was how I came across how to generate an event from a batch file in the first place. :)
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Can i specify a specific event to activate my macro?

Post by kgschlosser »

here is the link to the file

download/file.php?id=5797

replace eg\NamedPipe.py with the one from that link.
If you like the work I have been doing then feel free to Image
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Can i specify a specific event to activate my macro?

Post by blaher »

Cheers, it's working without any error now.
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Can i specify a specific event to activate my macro?

Post by kgschlosser »

hey ya do have to admin I am on top of the ball with getting things fixed.
If you like the work I have been doing then feel free to Image
Post Reply