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

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

Post by TomeG2kc » 22 Mar 2014 14:45

Hi,
I'm a noob, artist, not so good spoke English man and bought this great application. And I can copy/paste ;), I maked my own flow with silent profile in the night (and without screen rotating), GPS turning on when desired app is running and I'm trying to understood deepest rules of this app. But it's hard, for me, of course.
Meat:
I need to make 2 flows. Those aren't connected.
1. I'm using 2 step verification in Google services and I don't want use Authenticator. So, I'm using sms verification.
That's mean I need a flow which can read 6-8 last numbers from this sms and copy its to clipboard and paste it in desired place in web form. Only what I want need to do is touch "Continue". Without this I must copy it to clipboard in hard way = click in popup sms window on this number, it open dialer with this number (because Android thinks that it is a phone number), I must delete empty spaces bcoz Android add its things it's phone number, select all, copy, back, back, back, touch web form, and last but not least, paste.
2. I often make dishes and I'm using for it recipients from internet. When I find good recipe I start cook and always forgot turn off screen auto turn off. And after while I've a problem because ma hands are dirty and my phone/tablet has screen turned off.
I need a flow which can turn off autoturn off when I'm reading web page with word "recipe". That will be enough.
I'm noob and sorry of those questions requests are simple.
Please someone to tell me or give me a flows can do this. I'll try to study and learn how it's works.
I'm not sure that those request can be done, maybe only partially. But, if yes, show me a examples.
==
With regards
Thomas

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 » 23 Mar 2014 11:36

Hi,

1. I'm not sure how the SMS of Google looks exactly but you could build a flow that automatically copies the text to the clipboard like this:
-trigger SMS Received
-action Copy Text to Clipboard: {sms_text}
-action Notification on Screen: copied {sms_text} to the clipboard

or to copy only the last 6 characters of the sms:
-trigger SMS Received
-action Copy Text to Clipboard: {right(sms_text, 6)}
-action Notification on Screen: copied {right(sms_text, 6)} to the clipboard

Automatically entering the number in a web form will be very difficult. Maybe you could achieve this using action Control UI or with a rooted device and an action Execute Root Command: input text {sms_text}.


2. It's probably not possible to detect if the word "recipe" is currently displayed on screen. You could build a simple flow that changes the screen off timeout to 30 minutes when you are starting the browser:
Flow 1:
-trigger App Task Started: <browser>
-action Set Screen Timeout: 30 Minutes

Flow 2:
-trigger App Task Ended: <browser>
-action Set Screen Timeout: 5 Minutes


Regards,
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 » 23 Mar 2014 12:00

Thanx Martin.
Ad 1. Is possible to make flow which find specified app (browser running in background) and paste it into?
Ad 2. Yes, found it on the forum, but this isn't it what I'm looking for. And what about search actual .html file for finding into word "recipe". You know, when I see a recipe on the web page, I always see at least one time word "recipe" on it...

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 » 23 Mar 2014 12:45

1. I don't know how this could be achieved. When the browser is still open, and the text field has input focus, you could use the the action Execute Root Command: input text {sms_text} to paste the text.

2. Automagic has no access to the HTML file currently open in the browser so this won't work.

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 » 08 Apr 2014 22:40

Just one thing, how I can build this string {right(sms_text, 6)} when I found there is 6 numbers and after last is coma. This format = "Your Google pin is 123456."?

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 » 10 Apr 2014 09:18

You could extract the last 7 characters and then use the left 6 characters:
{left(right(sms_text, 7), 6)}

or use a regular expression to replace all characters that are not digits (assumes that the message contains no other numbers):
{replaceAll(sms_text, "\\D", "")}

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 » 10 Apr 2014 10:26

Thanx Martin. And what when I want to use it for bank-pin-sms? In that sms is date in format 10-04-2014 and for example model of my phone - GT-N7100. Is possible to solve it with those expressions? And how? Rules?

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 » 11 Apr 2014 07:38

You have to write a different expression for every type of SMS.
How does the bank SMS look like exactly, can you give a complete example SMS text?

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 09:01

Yes, I know I should make new flow. And sms from my bank look like this:
! Banking operation nr 1 from 04-04-2014. Password: 23534519 mBank.

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 » 11 Apr 2014 10:05

You could use a regular expression capturing group to extract the password.

This script is too long to use an inline expression so you have to put the following script into it's own action Script:

Code: Select all

sms_text = "! Banking operation nr 1 from 04-04-2014. Password: 23534519 mBank.";

//create an empty list that will contain the groups content
list = newList();

// complete text and the text within parenthesis will be filled into variable list
matches(sms_text, ".*Password: (\\d+).*", list);

//element at index 1 (second element) contains the text within the first group
password = getElement(list, 1);
Alternatively you could use indexOf and substring functions to get the password:

Code: Select all

sms_text = "! Banking operation nr 1 from 04-04-2014. Password: 23534519 mBank.";

//find the start index of the password
start = indexOf(sms_text, "Password: ") + 10;

//find the space after the password
end = indexOf(sms_text, " ", start);

//extract the text between start/end
password = substring(sms_text, start, end);

Post Reply