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.

Trying to run two macros at once, one checking the other

If you have a question or need help, this is the place to be.
Post Reply
loomy
Posts: 42
Joined: Sat Sep 22, 2007 10:07 pm

Trying to run two macros at once, one checking the other

Post by loomy »

Summary in the second last paragraph at the bottom :)

I'm trying to wake a HTPC in the middle of the night to do some software updates. Problem is, the software mute has to be in place before the computer wakes up, because the short delay between actual waking and the eventghost waking up event is long enough to let some sound out.

So I figure I need to mute the machine every time it goes to sleep, then unmute it 1 second after waking ONLY IF the software update program IS NOT running.

state: muted
when waking from standby, do:
wait 1 second in case software update is starting
if software update is detected, then end
if software update is not detected, then unmute.

But the problem is that eventghost macros aren't multithreaded, and I'm using it to both run the software updates AND check if the software updates are running. So while the above macro would run, another macro would have to run that does the updates... and I don't think that is possible with eventghost. (The operation of one macro blocks the operation of another. I cannot run a macro waiting for a program to end while simultaneously watching for when it ends)

What are my options here? Can eventghost do this, or do I need to run another session of a macro program, or is the python support in eventghost the way to go?
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Trying to run two macros at once, one checking the other

Post by Bitmonster »

PythonScripts allow all kind of threading.

But it is often easier to build an "event loop". Test your condition and use TriggerEvent with a delay to re-trigger your macro as long as the condition isn't met. This gives room to process other events in-between.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Post Reply