Tuesday, May 21, 2013

Popup sms notifier via tasker scene

Popup sms notifier via tasker scene



in my previous posts, i have mentioned that it is not significant to make popup sms notifier via tasker scene, cause it could only display 1 sms message(latest or oldest) which is not capable to deal with multiple situations.

however, during these days, i did discover a workaround which could fix this problem.

after done with my instructions below, you will be able to check every incoming unread sms messages just within 1 scene by pressing "next" or "previous" button, of course you will still need to activate another scene to fulfill the reply job which gives you full sceen input layout.

wondering how?

no rush, please read on.

please excuse me if you feel it is sorta messy below. let us consider it is a nice testing for your DIY ability.

^_^!!.....




ultimate effect: (FYI)







##############################################


profile 1: (popup sms notifier)

context: event-receive text, type: sms

task:

action: variable clear, name: %SMSBODY

action: variable set, name: %SMSJOIN1, to: %SMSRD

action: variable set, name: %SMSJOIN2, to: %SMSRT

action: variable set, name: %SMSJOIN3, to: %SMSRN

action: variable set, name: %SMSJOIN4, to: %SMSRF

action: variable set, name: %SMSJOIN5, to: %SMSRB

action: variable set, name: %SMSUNREAD, to: %SMSCOUNT+1, do maths, checked

action: variable join, name: %SMSJOIN, joiner: ; to: %SMSDATA

action: variable set, name: %SMSPOPUP,to: %SMSUNREAD{%SMSDATA}, append checked

action: variable search replace, variable: %SMSPOPUP, search: %SMSUNREAD.\w+.\w+.\w+.\w+.\w+.\w+.\w+. store matches in: %SMSSHOW, ignore case, checked (in order to match the regex, the format should be like: 2{2013-3-15;13.30;Cat;2053959909},{........... }

aciton: variable split, name: %SMSSHOW, splitter: %SMSUNREAD{

aciton: variable split, name: %SMSSHOW2, splitter: }

aciton: variable split, name: %SMSSHOW21, splitter: ;

action: variable set, name: %SMSDATE, to: %SMSSHOW211

action: variable set, name: %SMSTIME, to: %SMSSHOW212

action: variable set, name: %SMSNAME, to: %SMSSHOW213

action: variable set, name: %SMSNUM, to: %SMSSHOW214

action: variable set, name: %SMSBODY, to: %SMSSHOW215








profile 2:

context: variable value, name: %SMSBODY, OP: is set


task:

action: show scene, name: Popup sms notifier, display as: dialog, dim behind heavy, show exit button uncheck, continue task immediately, checked

action: misc-test,type: contact photo url, data: %SMSRF, store result in %CONTACTPHOTO

action: scene-element image, scene name: Popup sms notifier, element: Image1, image: %CONTACTPHOTO




In tasker variable tab, creat 2 global variables:

variable name: %SMSCOUNT, to: 0

variable name: %SMSINDEX, to: 1



(scene)
close button task:

tap:

action: scene-destroy scene, name: Popup sms notifier
action: variable clear, name: %SMSBODY



(scene)
next button task:

tap:

action: variable set, name: %SMSPOSITION, to: %SMSINDEX+1, do maths, checked

action: variable search replace, variable: %SMSPOPUP, search: %SMSPOSITION.\w+.\w+.\w+.\w+.\w+.\w+.\w+. store matches in: %SMSSHOW, ignore case, checked, if %SMSPOSITION !~ 1

aciton: variable split, name: %SMSSHOW, splitter: %SMSUNREAD{

aciton: variable split, name: %SMSSHOW2, splitter: }

aciton: variable split, name: %SMSSHOW21, splitter: ;

action: variable set, name: %SMSDATE, to: %SMSSHOW211

action: variable set, name: %SMSTIME, to: %SMSSHOW212

action: variable set, name: %SMSNAME, to: %SMSSHOW213

action: variable set, name: %SMSNUM, to: %SMSSHOW214

action: variable set, name: %SMSBODY, to: %SMSSHOW215



(scene)
previous button task:

tap:

action: variable set, name: %SMSREWIND, to: %SMSPOSITION-1, do maths, checked

action: variable search replace, variable: %SMSPOPUP, search: %SMSREWIND.\w+.\w+.\w+.\w+.\w+.\w+.\w+. store matches in: %SMSSHOW, ignore case, checked

aciton: variable split, name: %SMSSHOW, splitter: %SMSUNREAD{

aciton: variable split, name: %SMSSHOW2, splitter: }

aciton: variable split, name: %SMSSHOW21, splitter: ;

action: variable set, name: %SMSDATE, to: %SMSSHOW211

action: variable set, name: %SMSTIME, to: %SMSSHOW212

action: variable set, name: %SMSNAME, to: %SMSSHOW213

action: variable set, name: %SMSNUM, to: %SMSSHOW214

action: variable set, name: %SMSBODY, to: %SMSSHOW215




(scene)

mark as read button:

####please refer to my previous relevant posts to get the python sl4a script content.




(scene)

delet button:

####please refer to my previous relevant posts to get the python sl4a script content.




(scene)

reply button:

tap:

action: show scene, name: Popup reply, display as dialog dim heavy,  show exit button uncheck, continue task immediately, checked


(scene 2)

send button:

tap:

action: phone-send sms, number: %SMSNUM, message: %newval



profile 3:

context: unread text, invert

task:

action: variable clear, name: %SMSPOPUP

action: variable clear, name: %SMSUNREAD




Profile 4: (Kill scene)  ## Kill the scene once it got hidden in background, which means you no longer need it.

Context: unread text
Context: display off

Task:

Action: wait 5 minutes

Action: scene-element test, type: status, store result in % ELEMENTTEST, If %PACTIVE ~ kill scene

Action: destroy scene, name: Popup sms notifier, if  % ELEMENTTEST  ~ hidden

action: variable clear, name: % ELEMENTTEST




Tasker scene 1: (Popup sms notifier)

you may now add an image element to the any position you prefer within the scene, you may pick a picture as the default image if the sender doesn't have a contact photo in the contacts database.

previous, next, close, mark as read, delete, reply, buttons.

and the message body text viewer( you better choose text editor element instead, cause it could give you the drawable ability to pull up and down to see the full message if it is pretty long enough.)


Tasker scene 2: (Popup reply)

it could much easier to create this scene since you have got skillful of creating the 1st one. so, i guess i don't need to say too much about how to.


12 comments:

  1. Great job and thanks for posting, will try to recreate later :)

    ReplyDelete
  2. Anyway you can send my the profile and scene? I seem to be having issues with mine..
    Lear.shimi@gmail.com

    Thanks in advance!

    ReplyDelete
    Replies
    1. Hi,

      did you mean the profile XML file?

      if so, i am sorry, i won't. cause the profile configuration details is already posted above, i don't see it is necessary to publish the XML file.

      do your homework and let me know if any problem, i will see what i can do for you.

      Cathy

      Delete
  3. Ok, I have been trying to replicate this for a while now and am getting stuck on the regex.

    I understand that the ".\w+" represents a grouping of text separated by either blank space or punctuation. My question is this: How are you to predict the smsbody text? the seven regex alone only show up to the first name of the contact. If I do more I wind up going into the next message appended to SMSPOPUP.

    Either way I cannot get this to save the correct info into SMSSHOW to then be dealt with. I have tried various things and looked up information for about two weeks now. I have come up with some sort of work around but it only semi works.

    I'm also assuming when you say :"action: variable join, name: %SMSJOIN, joiner: ; to: %SMSDATA" this is actually two functions because tasker does not have an option to join two variables just to join arrays.

    Any suggestions or guidance would be much appreciated.

    ReplyDelete
  4. Hi, I am quite new to Tasker and would like to set it to display scene (I read how to do the scene) when an SMS is received, but I am not in the Message application. In fact, the best would be to display it only if I am at home screen or the telephone is locked. Is this possible?
    Thanks.
    MichelJ

    ReplyDelete
  5. In tasker you should be able to set one of the triggers to applications. So in that case set it to your home or the trigger for "keyguard on".

    You will need to make a variable for the keyguard since the built in variable will not work for state or event changes. In the example I have named it %KGT

    So your main trigger would be

    Profile:
    Application>(touchwiz/nova/apex/what have you)
    State>Variables>Variable Value>Name:%KGT, Op:none, Value:on

    If you need further help just let me know. I'd be happy to help.

    ReplyDelete
  6. Awesome post you have shared, which is informative and knowledgeable. I have read your previous post, and think both of them are informative. I appreciate your great job.

    Katie Lennon

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Hello,
    ""####please refer to my previous relevant posts to get the python sl4a script content.""

    I want to delete Single PopedUp msg. Your Previous Post is Confusing, WHICH ACTUAL MSG DELETING SCRIPT i have to put HERE(In This POPUP PROJECT)??

    One Other thing: There is no "To:" option in "VARIABLE JOIN" action.

    ReplyDelete
  10. https://technovelley.blogspot.com/2014/02/php-script-using-clickatell-api-for-sms.html?showComment=1567942656099#c6104580212293372501

    ReplyDelete