format %CNUM in international format

205 views
Skip to first unread message

Abhinav Khandka

unread,
Aug 27, 2013, 12:07:43 AM8/27/13
to tas...@googlegroups.com
Hi,
I want to store %CNUM in international format
Any help would be appreciated

Thanks

Abhinav
Message has been deleted

Brandon Horwath

unread,
Aug 27, 2013, 1:21:00 AM8/27/13
to tas...@googlegroups.com
You can't change tasker defined variables like %CNUM.

You are looking for action, phone, dial.

Matt R

unread,
Aug 27, 2013, 1:25:39 AM8/27/13
to tas...@googlegroups.com
You could use a sequence of Variable Section actions.

Matt

Abhinav Khandka

unread,
Aug 27, 2013, 11:21:16 AM8/27/13
to tas...@googlegroups.com
Hi Brandon 
Thanks for your reply. I am saving %CNUM to %num and then trying to do it. What I am trying to achieve is if there is an incoming call and caller is not in contact then format the caller number as +1-111-111-1111
Thanks

Abhinav

Brandon Horwath

unread,
Aug 27, 2013, 4:58:16 PM8/27/13
to tas...@googlegroups.com
Matt has your idea then :-)

Abhinav Khandka

unread,
Aug 27, 2013, 8:17:11 PM8/27/13
to tas...@googlegroups.com
I was able to split the number into an array
used something like
1 Variable St name %num to %CNUM
2. Variable Search Replace Variable %num Search [0-9] store matches In %numarray

This helps me google tts speak out number instead of billions and millions. However I want to display the number as +1-800-800-8000

Any idea how can i use regex, I have 1?\W*([2-9][0-8][0-9])\W*([2-9][0-9]{2})\W*([0-9]{4}) as expression.

Thanks

Abhinav Khandka

Abhinav Khandka

unread,
Aug 27, 2013, 8:17:18 PM8/27/13
to tas...@googlegroups.com

Matt R

unread,
Aug 27, 2013, 8:48:09 PM8/27/13
to tas...@googlegroups.com
Unfortunately, I don't think you can use grouping references from the search field in the replace field in Tasker's Variable Search Replace action. The only way I think you could do it would be would be to get your %numarray then use a Variable Set action to make a new variable %formatted to +%numarray(1)-%numarray(2:4)-%numarray(5:7)-%numarray(8:11). But then you'll have to go through another Variable Search Replace action to remove the commas. Another option would be doing it in a shell command using something like sed or awk (probably need busybox and perhaps a rooted phone). Or you could probably use JavaScript (which I'm unfamiliar with).

Matt

Brandon Horwath

unread,
Aug 27, 2013, 9:07:25 PM8/27/13
to tas...@googlegroups.com
Variable section will work though! Section the different fields to parse out the data you want.

%num = +18008008000 right? roughly?

Section %num 1:2 to %numregion ~ +1
Section %num 1:3 (or is it 3:5?) to %numarea ~ 800
etc, etc...

Abhinav Khandka

unread,
Aug 29, 2013, 11:32:52 AM8/29/13
to tas...@googlegroups.com
Thanks Guys,
I eventually used javascript to achieve this as I wanted to take care of some non-us calls too(more than one digit country code). Will post the profile shortly.
Reply all
Reply to author
Forward
0 new messages