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.

IF THEN ELSE with Actions

If you have a question or need help, this is the place to be.
Post Reply
m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

IF THEN ELSE with Actions

Post by m19brandon »

Hello, how can I do IF THEN ELSE with actions. I have a bunch of python script actions that I do this in and use "eg.plugins.*" command to execute actions but this makes the macros less visible and I was trying to avoids Jumps as this gets mess and makes it hard to copy and past other macros to reuse. Example.

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1640">
<Macro Name="IP2IR: Family Set to DVD (Computer)" id="485" Expanded="True">
<Action>
EventGhost.PythonCommand(u'eg.result = None')
</Action>
<Action>
EventGhost.PythonCommand(u'if eg.globals.bl1_status == False: eg.result = False')
</Action>
<Action>
EventGhost.PythonCommand(u'print eg.result')
</Action>
<Action>
EventGhost.NewJumpIf(XmlIdLink(536), 1, True)
</Action>
<Action>
EventGhost.PythonCommand(u'print eg.result')
</Action>
<Action>
EventGhost.PythonCommand(u'eg.result = None')
</Action>
<Action>
EventGhost.NewJumpIf(XmlIdLink(363), 2, True)
</Action>
<Action>
EventGhost.NewJumpIf(XmlIdLink(406), 0, True)
</Action>
<Action>
EventGhost.PythonCommand(u'print eg.result')
</Action>
<Action>
EventGhost.NewJumpIf(XmlIdLink(414), 0, True)
</Action>
<Action>
EventGhost.PythonCommand(u'print eg.result')
</Action>
</Macro>
</EventGhost>

Thanks in advance, B
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: IF THEN ELSE with Actions

Post by jonib »

m19brandon wrote:Hello, how can I do IF THEN ELSE with actions.
Use the "EventGhost\Jump" action.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: IF THEN ELSE with Actions

Post by m19brandon »

That is want I'm doing now also but I want to stay in the same Marco.
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: IF THEN ELSE with Actions

Post by jonib »

m19brandon wrote:That is want I'm doing now also but I want to stay in the same Marco.
I don't think that's possible without using a Python script.

Why do you need to stay in the same macro? If you group macros in a folder it's almost like a single macro. :twisted:

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: IF THEN ELSE with Actions

Post by m19brandon »

Yes, I could do that :) Thanks, :D :D
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: IF THEN ELSE with Actions

Post by Pako »

I added a new action Jump with "Else" option to new EventGhost release.
This should facilitate the design that you need.

Pako
m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: IF THEN ELSE with Actions

Post by m19brandon »

You are the man.
Post Reply