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.

run once at keypress but not again at keypress

If you have a question or need help, this is the place to be.
Post Reply
Sonopanic
Posts: 22
Joined: Mon Dec 08, 2008 8:30 am

run once at keypress but not again at keypress

Post by Sonopanic »

My TV only have a Power Toggle command.

I created a "Start System" macro which turns the tv on, switch to the right input etc.
When i press this button again, the tv turns off - not good.

My thoughts are, make a phyton script with a branch if a variable is set (system already on)
and terminate the macro "Start System".
If the variable is not set, then set the variable and execute the macro.

Question is, how is the right syntax of the script - if this is the right way to do it.
Perhaps there is a better way.
stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: run once at keypress but not again at keypress

Post by stottle »

There really isn't a good way if the only IR signal is power toggle. However, a lot of TV's have discrete on/off signals, even if the remote doesn't include the button. I would check remotecentralfor your TV and see if they have more codes.

Brett
Sonopanic
Posts: 22
Joined: Mon Dec 08, 2008 8:30 am

Re: run once at keypress but not again at keypress

Post by Sonopanic »

This answer is not the way for me.
There is no other command, and i want to use EG to deal with the problem.
Diabl0570
Posts: 30
Joined: Sun Feb 28, 2010 6:05 pm

Re: run once at keypress but not again at keypress

Post by Diabl0570 »

in the autoRun put a python command:

Code: Select all

eg.globals.TVisON="false"
make a macro with python script:

Code: Select all

if eg.globals.TVisON=="true":
    eg.plugins.EventGhost.TriggerEvent(u'Event_If_TV_is_on', 0.0)
else:
    # here you need to switch the tv on 
    eg.globals.TVisON="true"
    eg.plugins.EventGhost.TriggerEvent(u'Event_switch_tv_on', 0.0)

note that this code is not tested
but this is basically it!
good luck!
Post Reply