Execute EG Macros from a Desktop Shortcut

If you have a question or need help, this is the place to be.
Post Reply
harpua1982
Posts: 2
Joined: Sun Oct 16, 2016 3:30 pm

Execute EG Macros from a Desktop Shortcut

Post by harpua1982 » Mon Jan 02, 2017 12:39 pm

I apologize if this seems simple and/or is already answered here on the site. I'm rather new at this amazing program and perhaps I may have worded it wrong in my past searches.

I know how to create Macros and Events in EventGhost. I also know how to have actions trigger those tasks (events, macros). In fact, I've used several triggers, such as HotKeys, AutoRemote Messages received, time, active/deactive profiles, ect, ect, ect.

What I haven't figured out yet (it's probably staring me in the face) is how to execute some EventGhost commands (Macros/Events) that I've created from a .bat script or Desktop shortcut.

For example, I have several instances of RocketDock installed on my Multi-Monitor Computer setup.
I also have many other "computers" around the house such as a Laptop, 2 Android boxes, 5 phones or tablets
I want a desktop shortcut for each that will, w/ the help of EventGhost, allow me to remote control each of those devices on my main computer (MainFrame).
I can then load 'em in the RocketDock and launch from there.
There are several tasks that need to be executed through EventGhost and on each device for this to work correctly.
If I'm trying to remote control one of my android boxes, here's the steps I'd have to go through to make this happen the way I'm planning:

- Send an AutoRemote message w/ EventGhost to my Android box - This will open VNC Viewer and TeamViewer Quickconnect apps on the Android box w/ the help of Tasker.
- Open TeamViewer on computer (MainFrame) - DisplayFusion should specify which monitor, but this might change if I'm able to get multiple android devices working...
- run a few Macros to automate connecting to specific device.

I can do this w/ a Hotkey, which I probably plan to do, anyway, but I'd love to execute it from the desktop.
Am I missing something extremely simple?

Thanks in advance for your help.

jonib
Plugin Developer
Posts: 1280
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Execute EG Macros from a Desktop Shortcut

Post by jonib » Tue Jan 03, 2017 2:26 am

harpua1982 wrote:I can do this w/ a Hotkey, which I probably plan to do, anyway, but I'd love to execute it from the desktop.
Am I missing something extremely simple?
The -event command line option maybe.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

blaher
Experienced User
Posts: 481
Joined: Thu Nov 17, 2011 1:27 am

Re: Execute EG Macros from a Desktop Shortcut

Post by blaher » Tue Jan 03, 2017 3:01 am

jonib wrote:
harpua1982 wrote:I can do this w/ a Hotkey, which I probably plan to do, anyway, but I'd love to execute it from the desktop.
Am I missing something extremely simple?
The -event command line option maybe.

jonib
Yeah, that's what I use, a batch file with:

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

harpua1982
Posts: 2
Joined: Sun Oct 16, 2016 3:30 pm

Re: Execute EG Macros from a Desktop Shortcut

Post by harpua1982 » Wed Jan 04, 2017 11:34 pm

jonib wrote:
harpua1982 wrote:I can do this w/ a Hotkey, which I probably plan to do, anyway, but I'd love to execute it from the desktop.
Am I missing something extremely simple?
The -event command line option maybe.

jonib
Yep. I probably shouldn't have posted this. As a matter of fact, I figured it out not even 10min later w/ a .bat file. I also forgot to mention my version # as per board rules. I tried to delete, but it was awaiting approval.

I guess I'll leave it up in case some newbie, like me, happens to search it.

Anyway, thanks for the input. What an amazing program!

farbox
Experienced User
Posts: 53
Joined: Fri Jul 18, 2008 1:44 am

Re: Execute EG Macros from a Desktop Shortcut

Post by farbox » Wed Jan 03, 2018 11:57 pm

Maybe im being a bit stupid, but I cant get the bat file thing to work....
Need a desktop "button/shortcut" to start a certain macro using a mouse, so I found this thread.

So to check:
Created a xxxx.bat file on desktop
text inside .bat file is exactly as below:

C:\Program Files (x86)\EventGhost\EventGhost.exe -event Start Zoomplayer movie
(also tried "C:\Program Files (x86)\EventGhost\EventGhost.exe -event Start Zoomplayer movie)

"Start Zoomplayer movie" is the macro name, which I wish to trigger from my desktop by double clicking the bat file. But nothing is happening.
The wiki -event <eventname> [<payload> ...] confused me even more.
I'm sure I'm doing a syntax error or something...

What am I doing wrong? Do I need to reference only an event rather than a macro?
Can one of you guys copy/paste the actual .bat file text please?

cvben
Posts: 38
Joined: Wed Jun 07, 2017 8:30 pm

Re: Execute EG Macros from a Desktop Shortcut

Post by cvben » Thu Jan 04, 2018 12:12 am

Make sure you put quotes around just the path per the example below. Windows doesn't like the space in "program files"

"C:\Program Files (x86)\EventGhost\EventGhost.exe" -event Start Zoomplayer movie

After this triggers you'll see an event in the log (the yellow lightning bolts)

Image

See (movie.Start u"Zoomplayer"), that the event you triggered. Drag it to the top of the macro you want to trigger, like starting the program zoomplayer, then when you run the shortcut, it triggers the action and voila, you run the program.
Last edited by cvben on Thu Jan 04, 2018 12:18 am, edited 1 time in total.

farbox
Experienced User
Posts: 53
Joined: Fri Jul 18, 2008 1:44 am

Re: Execute EG Macros from a Desktop Shortcut

Post by farbox » Thu Jan 04, 2018 12:16 am

Thank you!
Your text gives me this error:

^
SyntaxError: invalid syntax
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 0x050E85B0>
^
SyntaxError: invalid syntax


PS I updated eg to 5 RC4, and no longer get an error.
But nothing is happening neither, ie no execution of the macro is taking place....
Last edited by farbox on Thu Jan 04, 2018 12:22 am, edited 1 time in total.

cvben
Posts: 38
Joined: Wed Jun 07, 2017 8:30 pm

Re: Execute EG Macros from a Desktop Shortcut

Post by cvben » Thu Jan 04, 2018 12:19 am

Can you screenshot your macro?

farbox
Experienced User
Posts: 53
Joined: Fri Jul 18, 2008 1:44 am

Re: Execute EG Macros from a Desktop Shortcut

Post by farbox » Thu Jan 04, 2018 12:28 am

Super simple macro:

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc4">
<Macro Name="Start MOVIE zplayer.exe" XML_Guid="{58F8FF9B-8ADB-4857-8619-42AF43069AE1}" Expanded="True">
<Event Name="MceRemote.373F" XML_Guid="{BDE71840-D6A3-44D7-A0C5-05D9E1E5575E}" />
<Action Name="Start Program: zplayer.exe movie" XML_Guid="{3C0FCB04-1672-4060-9CB4-7CE5540AD366}">
System.Execute(u'C:\\Program Files (x86)\\Zoom Player\\zplayer.exe', u'"/config:C:\\ProgramData\\Zoom Player\\movie setup.local"', 0, False, 2, u'', False, False, u'', False, False, False)
</Action>
</Macro>
</EventGhost>

Image
Just saw your post update, thank you.
Im not getting the event appearing in eg


PS
ALL OK NOW!
AS I thought, I was being really stupid.
I had checked the "show only assigned events" in the log window, silly me!
Its working now!

Thank you so much for your advice!

cvben
Posts: 38
Joined: Wed Jun 07, 2017 8:30 pm

Re: Execute EG Macros from a Desktop Shortcut

Post by cvben » Thu Jan 04, 2018 12:42 am

Edit: All right, cool

Post Reply