Script Function - Stop

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
lubrasko
Posts: 7
Joined: 25 Apr 2013 15:21

Script Function - Stop

Post by lubrasko » 26 Apr 2013 22:14

Would be great if we could stop the Flow from with script function.

I would like to use this to create custom conditioning (e.g. If Variable = this, the flow continues, otherwise Stop).

I apologize if this already exists.

Thank you,
L.

LightTempler
Posts: 53
Joined: 17 Mar 2013 16:08

Re: Script Function - Stop

Post by LightTempler » 27 Apr 2013 14:11

If your condition 's result leads to nowhere, your flow just stops. No further command needed :-)

lubrasko
Posts: 7
Joined: 25 Apr 2013 15:21

Re: Script Function - Stop

Post by lubrasko » 27 Apr 2013 16:04

Ok,
But then how do I set it up to go on under certain conditions?

Let's say I have this.

If (value = 0)
{
}
Else
{
}

I want it to continue only if value = 0.
Is there a command to go on to next step?

Thanks.

inReinbek
Posts: 95
Joined: 02 Feb 2013 22:04

Re: Script Function - Stop

Post by inReinbek » 27 Apr 2013 20:58

Sure ... delete the "else"-process ... only "if" is enough to let the flow work on value==0.

lubrasko
Posts: 7
Joined: 25 Apr 2013 15:21

Re: Script Function - Stop

Post by lubrasko » 28 Apr 2013 01:57

Sorry I can't seem to figure this out. What am I doing wrong?

What I am trying to accomplish is this.

I have a flow needs to turn on/off screen but only if the Alarm clock app is active.

So I check if the package is running and one of the variables that this action is returning is the Index, which tells me if it is "on top" or not. It returns the index of ) for the package that is currently being displayed ("on top").

This works well and I can show the notification with the {index} and it shows me 0 when the Alarm clock is being used at the moment.

So what I want is to tell the script to stop when {index} is anything else but 0.

I am not good at Java Script (I do programming however in VB.NET).

Script:

if (index != 0)
{
}

Everything I've tried either stops the flow all the time or finishes the flow all the time. What am I doing wrong?

BTW - also this probably can be moved over to Help section instead of feature request. Even though I think the "formal Stop Flow" in the script would be much nicer solution.

Thanks a lot.

L.

lubrasko
Posts: 7
Joined: 25 Apr 2013 15:21

Re: Script Function - Stop

Post by lubrasko » 28 Apr 2013 04:18

Why I couldn't figure this out earlier is beyond me, but my problem is now solved!

I just used the Condition - Expression to separate the paths based on {index}.

It works well.

Locked