Page 1 of 1

Passing variables between conditions/action within a flow

Posted: 06 Jan 2015 13:05
by ronCYA
I think I'm missing something and/or doing something completely wrong. As I understand, any variable set using the Script action should then be available everywhere else further down in the flow, right? Yet for some reason I am not seeing any of my own variables in the "Select Variable" drop-down menu.

My flow ultimately takes a WhatsApp notification and posts the body text of it to Facebook. Overall the flow is working at the beginning (grabbing the WhatsApp notification) and end (posting to Facebook) but I'm having trouble parsing the notification with Script. Here's the entirety of my Script action:

Code: Select all

whatFace = split(notification_text_big, "\\n"); //Split entire notification into separate lines
thirdLine = getElement(whatFace, 2); //Specify the third line, which is where the message body text begins
whatFaceVariations = newList("WhatFace", "Whatface", "whatFace", "whatface", "What Face", "What face", "what Face", "what face"); //Create a list of various ways to type "WhatFace" to check through

/*
Checks the message text for variations of "WhatFace"
Removes any instances of variations of "WhatFace"
Combines the lines in the message in one variable, excluding the sender (first line) and line break (second line)
Returns true if variations of "WhatFace" were found
*/

for (variation in whatFaceVariations)
{
	if (contains(thirdLine, variation))
	{
		thirdLine = replaceAll(thirdLine, variation, "");
		getElement(whatFace, 0) = replaceAll(getElement(whatFace, 0), "");
		getElement(whatFace, 1) = replaceAll(getElement(whatFace, 1), "");
		whatFaceTriggered = true;
	}
}
If I then link this action to another action/condition, shouldn't the variables set be available to select? (e.g. whatFace and whatFaceTriggered I don't mean global variables to use in another flow, just local variables within the same flow.

Sony Xperia TX (LT29i)
Android 4.3
Automagic Premium 1.26.0 (Build 20141219_133159_4ba158f)

P.S. - Thank you Martin (and team?) for your efforts in developing such an amazing app/system! Your patience and dedication to helping users and making Automagic better is commendable :)

Re: Passing variables between conditions/action within a flo

Posted: 06 Jan 2015 21:46
by Martin
Hi,

The local variables created by a script should be seen by the 'Select Variable'-dropdown in a successor-action of the script action. Could you share the flow or send the flow to info@automagic4android.com so I can have a look?
You could also add a condition Debug Dialog to the flow and see what variables are really available when the action was executed. Maybe it's just a bug in the dropdown so you could use the variable in the following actions/conditions when you manually type the name of the variable.

Regards,
Martin