copy pin from sms&turn of auto screen off when web containin

Post your questions and help other users.

Moderator: Martin

TomeG2kc
Posts: 13
Joined: 22 Mar 2014 13:40

Re: copy pin from sms&turn of auto screen off when web conta

Post by TomeG2kc » 11 Apr 2014 12:45

Hi, this first part about 'script into it's own action Script' is too hard for me, I don't undestand things with 'lists', even variables :? /). But I wish to.
Is this list is created as a file, or only in memory, in this specifeid time when script is running? Bcoz it in file, I don't want to store my, even old sms-paswords, in a file. And what means those signs only \\d+).*" (rest is obvious for me).
But second way I understand little bit more and only I don't undestand is + 10 - this password contains 8 digits, not 10 - is this only a small mistake or I don't understand this formula?
And next what I'm not understand (most important) is how I can use this code in my flow, where I can put it? This is my main problem... sorry :ugeek:

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: copy pin from sms&turn of auto screen off when web conta

Post by Martin » 12 Apr 2014 07:26

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

Post Reply