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.

cancel a delayed "trigger event"

If you have a question or need help, this is the place to be.
Post Reply
manjh
Posts: 41
Joined: Thu Mar 12, 2009 11:14 am

cancel a delayed "trigger event"

Post by manjh »

I am using "trigger event" with a delay to switch devices on and off for a set length of time.
But sometimes I'd like to be able to cancel such a delayed trigger.
I tried to use "clear pending events", but since the trigger hasn't happened yet, that does not effect the delayed trigger as it is not an event yet.
Is there any other way to do this? Or am I stuck with this delay, and have to wait it out?
manjh
Posts: 41
Joined: Thu Mar 12, 2009 11:14 am

Re: cancel a delayed "trigger event"

Post by manjh »

OK, never mind. Found a workaround myself.
Instead of using the trigger event I will use a combination of two timer actions: the first to cancel an already running timer, the second to start the timer with the right amount of time.
Now if someone activates the macro (by pushing a button on a remote), and then does it again later on, it will restart the timer and give that second button-push the right amount of time.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: cancel a delayed "trigger event"

Post by krambriw »

Hi,

I was thinking about another way that might work too and that would be simpler to maintain (if it works of course, haven't tested it, just a theory at this point...)

When you use the EventGhost action "Trigger Event" with a delay, you are actually scheduling this with the eg.Scheduler

So, if you have the event name, the following should work:

This is how EG schedules your event (when you press Apply or OK in the configuration dialog for the "Trigger Event" action

Code: Select all

eg.scheduler.AddTask(waitTime, eg.TriggerEvent, eventString)
where eventString is the name of your event you just defined


If you would like to cancel this (before it is started) you could try

Code: Select all

eg.scheduler.CancelTask(eventString)

Best regards, Walter
Post Reply