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.

Help: disable macro if a condition is meet.

If you have a question or need help, this is the place to be.
Post Reply
fabs
Posts: 2
Joined: Sun May 18, 2014 7:16 pm

Help: disable macro if a condition is meet.

Post by fabs »

hi. i've been using event ghost for some time and i'm having some trouble.
as i use eventghost on a HTPC as the windows shell, i've configured a macro that automatically restarts XBMC if it crashes, using process watcher (Process.Destroyed.XBMC -> run program XBMC.exe)
what i want to do is to disable that macro if steam is running.
so if steam is running, kill xbmc. and if steam is closed, run xbmc again. but if i put, said macro, the one mentioned before will fire up and reopen xbmc.
any way to disable the macro if another macro is active and reenable it after closing?

thanks for answering
Dragon470
Experienced User
Posts: 205
Joined: Thu Feb 10, 2011 2:16 am

Re: Help: disable macro if a condition is meet.

Post by Dragon470 »

Here is a little script you can use:

Code: Select all

from eg.cFunctions import GetProcessDict

newProcesses = GetProcessDict()
for x in newProcesses:
    if "notepad.exe" == str(newProcesses[x]):
        print "Process found, now stopping script"
        eg.StopMacro()
just replace notepad.exe with steam.exe or whatever it is. This will stop the macro if it finds the specified program.
kkl
Experienced User
Posts: 317
Joined: Wed May 04, 2011 9:32 pm

Re: Help: disable macro if a condition is meet.

Post by kkl »

Depending on the specifics of what you're trying to do, you may also want to look at an example that comes with the default .xml file for EG: Under Other Examples -> State Macro Example. Each macro enables or disables another macro depending on the status of something. There's also a second example.
Capture.JPG
fabs
Posts: 2
Joined: Sun May 18, 2014 7:16 pm

Re: Help: disable macro if a condition is meet.

Post by fabs »

Dragon470 wrote:Here is a little script you can use:

Code: Select all

from eg.cFunctions import GetProcessDict

newProcesses = GetProcessDict()
for x in newProcesses:
    if "notepad.exe" == str(newProcesses[x]):
        print "Process found, now stopping script"
        eg.StopMacro()
just replace notepad.exe with steam.exe or whatever it is. This will stop the macro if it finds the specified program.

took me a while to figure out that this script was case-sensitive, but this worked flawlessly. thanks for your help. :P
kkl wrote:Depending on the specifics of what you're trying to do, you may also want to look at an example that comes with the default .xml file for EG: Under Other Examples -> State Macro Example. Each macro enables or disables another macro depending on the status of something. There's also a second example.
Capture.JPG
this is awesome!. i had no idea eventghost could do that. will try to experiment on that.

i mainly use EventGhost as a replacement for the windows shell and as a launcher of startup/crash-recovery of media center apps. so my configuration is very simple at the moment: some server apps on autostart, a macro to restart crashed apps and another for killing an app is another app is launching and restoring it if it closes. :)
Post Reply