AutoNotification Missing %antitle for some apps when querying

Discussion in 'AutoApps' started by Jin, Jun 28, 2017.

  1. Jin

    Jin New Member

    Joined:
    Jun 28, 2017
    Messages:
    8
    Likes Received:
    0
    The task I’m trying to accomplish is to read all active notifications, then filter out certain apps, and store the anapp, antitle, and antext in a file. My problem occurs in the following case:
    • I use AN Query to query all non-persistent notifications
    • For reasons I have not figured out yet, some apps (such as Clock) will create two entries, with their anapp | antitle | antext as follows:
    1. Clock | Upcoming alarm | Wed 12:30 PM
    2. Clock | %antitle2 | %antext2
    • This is fine and maintains the correct array sizes, EXCEPT when Clock is the “last” notification in these arrays. In this case, “%antext2” is written in the antext array, but “%antitle2” is NOT written into the antitle array – it is simply not included in the array. This will create anapp and antext arrays that have one more entry n them than antitle.
    • Next, when I try to use AutoTools to perform filters and sorting on these arrays, I receive an error “Arrays to filter must be of same size” and the task fails to complete.

    Anybody have a solution to this?

    Thanks,
    Jin
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    So what happens if you flash %antitle2 in those situations?
     
  3. Jin

    Jin New Member

    Joined:
    Jun 28, 2017
    Messages:
    8
    Likes Received:
    0
    I currently have 2 notifications, CNN and Clock. I get strange results depending on if I flash the full array or just the last variable:

    Input: Flash "%anapp();%antitle()"
    Output: "CNN,Clock,Clock;News alert,Upcoming alarm"

    Input: Flash "%antitle3"
    Output: "%antitle3"

    The problem still occurs though when I write the arrays to a file. The %antitle() line does not contain a third element.
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Yes, that's normal because of the way Tasker handles arrays.
    If the value isn't there it'll not show the value at all when flashing an array.

    what you can do is do For loop and then select each item individually and write them that way, instead of writing the whole array in one action.
     
  5. Jin

    Jin New Member

    Joined:
    Jun 28, 2017
    Messages:
    8
    Likes Received:
    0
    Thanks, that seemed to do the trick!

    I also have a few questions about using AutoTools with AN arrays that I can't seem to figure out:
    1) The Filtering > Unique doesn't seem to work for me.
    Say I have AutoTools configured as follows after doing an AN query:
    Input Arrays: %anapp()|%antitle()|%antext()
    Output Arrays: filterapp|filtertitle|filtertext
    Filtering > Unique: checked

    When I flash %filterapp() I still see two values for Clock.
    Am I missing how Unique is supposed to function? Does it filter on the entire combined input row, not just the value in the first array?

    2) I can't figure out what to put in the Filtering > Filter field, depending on what I put it either keeps all values in the array or none of them. For example, if I put "Clock" into that field, it keeps the whole array intact. If I put "clock" then it keeps no values in the arrays. What would I put in there if I want to filter OUT all "Clock" values from %anapp()?
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    1) Yes, that's correct. Are they maybe slightly different? Like, is there an extra space somewhere in one and not the other?
    2) That happens because all entries match "Clock" and none match "clock" :) There's no way to remove all entries with some text, sorry! You can only define filters for what you want to keep.

    Hope this clarifies it!
     
  7. Jin

    Jin New Member

    Joined:
    Jun 28, 2017
    Messages:
    8
    Likes Received:
    0
    1) I don't see any differences at all when I flash @filterapp(1) and @filterapp(2), or when I write it to a file, so I have no idea what's going on.
    2) Are you planning to implement a NOT filter at some point? I think that would be very useful.
     

Share This Page