Hi,
The examples use local variables which are only held in memory, are not saved to disk and will vanish when the flow ends.
Automagic also supports global variables (when the name of the variable starts with
global_). Please see the help page of action
Script or online
here.
The first example uses regular expressions, which is a very powerful feature but also complicated to understand. Please check this page for an introduction about regex:
http://en.wikipedia.org/wiki/Regular_expression
The
+ 10 in the second example is used to find the index where the actual password starts.
The first part of the expression
indexOf(sms_text, "Password: ") finds the position of the 'P' from word 'Password' so I have to add 10 to skip the first 10 characters so the variable
start contains the position/index of the first digit of the password.
You can add a new action
Script in a flow:
-open the flow
-select the box containing the triggers and add a trigger
SMS Received
-drag the (+)-icon under the trigger rectangle to a free area
-select
Action
-select button
New...
-scroll down and select
Script
-fill the script int the field
Script (without the first line, since the variable
sms_text should be provided by the trigger)
-press
Save
You should now have a flow with a trigger
SMS Received and an action
Script.
You can now attach another action to the
Script action by using the (+)-icon again.
For testing purposes I recommend to create a flow with two actions so see if the script works properly:
-trigger
SMS Received
-action
Script: start = indexOf(sms_text, "Password: ") + 10;...
-action
Notification on Screen: {password}
You could also keep this line in the script for testing purposes:
sms_text = "! Banking operation nr 1 from 04-04-2014. Password: 23534519 mBank.";
This will allow you to execute the flow manually (menu->Execute) and see if the script works properly without actually receiving an SMS from your bank.
Regards,
Martin