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.

How to interrupt ongoing process?

If you have a question or need help, this is the place to be.
Post Reply
Hammaskejju
Posts: 4
Joined: Mon Sep 02, 2013 6:29 pm

How to interrupt ongoing process?

Post by Hammaskejju »

I have a data projector which I'm using with the TV and Media Center. However, every time I change between TV and media center, the projector shuts down. I can't really fix this just by changing the commands of the remote control. The only option is to do it in EG.

So the scenario goest like this:
1. I watch a movie with media center. Then I choose to watch TV. I press the "Watch TV" button in my remote. By doing this my remote activates "Kill projector" macro. This macro executes a Tellstick action to control the power socket of the projector. I could use the IR commands of the projector, but IR is not as reliable than the Nexa/Tellstick .

So, I came up with this idea of enabling or disabling the task with a timer (wait some time). I thought it would be a good idea to wait a little and see, if the shutdown is really needed to be done. When shutting down the system, this macro works fine: After watching someting I press "Power off" button in my remote. This shuts everything down as planned.

So, again, in my scenario, when I change from Media Center to TV, the process goes like this:
1. I have Media Center activated
2. The I Press "Wathc TV" -button on remote conrol
3. The EG get's the shutdown projector -signal (This point the remote control can not know, if the projector needs to be shut down)
4. Pre-shutdown timer starts to count down (6 seconds).
5. During the countdown the EG get's new signal: Enable TV with projector. This command deactivates (disable an item) the shutdown macro. But the macro runs to the end, bacause the "disable and item" -command is taking place only after the running macro has ended.
6. Projector shuts down

So, my question is: How to interrupt this running macro?
It has already started. The timer started to count down. Then in the middle of the countdown I got a new event: Enable projector. In this point the countdown has to be interrupted in order to prevent the shutdown. But the shutdown takes place, no matter what. Disabling the whole macro wont help. I tried to find a way to use the "if then else" -commands. But it seems like they are not ment to be used this way. Do I have any options left?

Hopefully you could understad this 8)
Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: How to interrupt ongoing process?

Post by Aquila »

If you use the timer plugin, you can start a timer in the first macro. And then let the event from the timer start a macro to kill the projector. You can then interupt the timer by simply disableing the macro that kills the projector.

But why is "Watch TV" and "Kill projector" in the same macro in the first place. Can't you seperate them?

Maybe if you show a printscreen of your current settings it would be easier to understand.
mickelin
Experienced User
Posts: 85
Joined: Sun Jan 04, 2009 5:54 pm

Re: How to interrupt ongoing process?

Post by mickelin »

Or even better, just abort the running timer, no need to disable the macro.

However, it is always a good practise to let the the fan run and cool down the lamp, not good to just shut off the power abruptly. I have a similar solution but my timer is 15 minutes before the Tellstick kills the power.
Hammaskejju
Posts: 4
Joined: Mon Sep 02, 2013 6:29 pm

Re: How to interrupt ongoing process?

Post by Hammaskejju »

Thank You for your ideas!
If you use the timer plugin, you can start a timer in the first macro. And then let the event from the timer start a macro to kill the projector. You can then interupt the timer by simply disableing the macro that kills the projector.
This is exactly the way I've ben doing this so far. But this doesn't work, because once the timer has tarted, it can not be interrupted just by disabling a macro. This "Disable macro" -command takes place only after the previous task has been completed. Therefore it is too late.
But why is "Watch TV" and "Kill projector" in the same macro in the first place. Can't you seperate them?
The remote control runs the shutdown process inside the remote control. When I chance to TV or media center, the previous task has to be shut down. The remote control doesn't know that I continue using the screen. So it shuts them down. I can't really chancge this, because of the way the remote control software operates (Logitech Harmony). You can control and priorizise certain things, but at the end there's still a lot of things You couldn't do or adjust.
Or even better, just abort the running timer, no need to disable the macro.
This is the solution I was trying to do. But I don't quite understant how to abrot the running timer?
However, it is always a good practise to let the the fan run and cool down the lamp, not good to just shut off the power abruptly. I have a similar solution but my timer is 15 minutes before the Tellstick kills the power.
There is no point on cooling the lamp down. The whole idea of "cooling the lamp" is nonsense. The idea of running the fan is actually to cool down the porjector itself and make the heat go out. This prevents the projector inner parts to warm up behind the lamp. However, many projectors these days doesn't even cool down after switching them off (like the one I have). There's even a menu option to enable the control of projector directly just by switching the AC.
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: How to interrupt ongoing process?

Post by jonib »

The "Wait some time" action works only for short delays, as you discovered it blocks any other actions until it's done waiting.
Try the "Timer" plugin instead it creates an event when the time is up and can run a macro, you would need to separate your macro in two parts.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: How to interrupt ongoing process?

Post by Pako »

jonib wrote:Try the "Timer" plugin instead it creates an event when the time is up and can run a macro, you would need to separate your macro in two parts.
It is unnecessary to use the Timer plugin for this purpose.
You can use core plugin EventGhost and the action Trigger Event.
There you can set the required delay.

Pako
mickelin
Experienced User
Posts: 85
Joined: Sun Jan 04, 2009 5:54 pm

Re: How to interrupt ongoing process?

Post by mickelin »

But using EventGhost Trigger Event does not allow you to abort the delay timer, does it? To abort a running timer using the Timer plugin, just create a second timer action,using the same timer name and select the Abort option.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: How to interrupt ongoing process?

Post by Pako »

mickelin wrote:But using EventGhost Trigger Event does not allow you to abort the delay timer, does it? To abort a running timer using the Timer plugin, just create a second timer action,using the same timer name and select the Abort option.
That is true.
I did not watch the whole topic and I responded only to that particular sentence.
I'm sorry.
Name of the topic How to interrupt ongoing process? did not say it would be necessary to deal with resettable timer.

Pako
Hammaskejju
Posts: 4
Joined: Mon Sep 02, 2013 6:29 pm

Re: How to interrupt ongoing process?

Post by Hammaskejju »

I want to thank you all for help! Everything is working like a charm now!
The timer abort really does the thing!
Post Reply