AutoTools Bug or feature request to handle arrays with sep in one item

Discussion in 'AutoApps' started by nirmelamoud, Sep 25, 2019.

  1. nirmelamoud

    nirmelamoud New Member

    Joined:
    Apr 21, 2019
    Messages:
    15
    Likes Received:
    0
    HI,

    I have an array where the separator is "," , but also one of the items could have "," in it, this is very common, in my case I do not have control over the array creation, I can, of course, rebuild it, but I rather not do that.
    the problem i have is that autoTools tools do not know, as much as I can tell, how to deal with it, for example:

    if my array has 3 items 1,2, 3,4 (where 3,4 is the third item) if I do a loop over the array I get the right result - 3 items where the third is 3,4

    but if I use list dialog to show this array it will split it incorrectly and will show 4 lines 1,2,3,4
    the same will happen if I merge this array with another array lets say a,b,c
    I will get the third item in the merge array to be 3#c (assume my merge format is {1}#{2}

    why cant the auto Tools deal with array correctly? why does it have to (probably) convert it into a string, than iterate on it ?

    is there a way to configure the tools in AutoTools to handle arrays the way I expect it to ? or I have to throw it away and do it myself with for loops ?

    here is a test task I built to show the problem.

    thanks
     

    Attached Files:

  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Hi there. To handle that correctly you first need to use the Variable Join to join all the items in an array with a character you're sure that doesn't appear in the array. Then in the AutoTools actions that use the array use the same character as the Joiner.

    Hope this helps! :)
     
  3. nirmelamoud

    nirmelamoud New Member

    Joined:
    Apr 21, 2019
    Messages:
    15
    Likes Received:
    0
    I know, but that is not a good solution as I cant be sure a specific character will not be present, as I have no control over the input source ,
    I hope you will consider a more robust solution, I can implement myself of course, but better if will be part of the language in my opinion - no rush
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Unfortunately it's how Tasker was built since the very beginning: if you use an %array() variable inside a plugin it'll automatically expand that to a string with comma separators. The plugin doesn't even know that it was an array to begin with. Sorry, I think we're in too deep now to change this behaviour :)
     
  5. nirmelamoud

    nirmelamoud New Member

    Joined:
    Apr 21, 2019
    Messages:
    15
    Likes Received:
    0
    Maybe Im not explaining myself well enough, sorry about that, Im not talking about a plugin, but about perform task action
    Im asking if we can add a new array functionality that wille encode an array to a string , similar to () but using some encoding, for example

    calling %array() dump the array to a string with a sep, but calling %array[64] (for example) will dump an array to a string encoded in a base 64 encoding (and you can add other encoders as you wish to extend this functionality
    to decode we will need an arrat action like part of var you will have arrayDecode action when the parameters will be the array itself and the encoder type (64 in this example)

    this way you just add functionality so it wont break any existing tasker code/concept
    if someone want to use it , he can , if not no harm done

    is that make sense ? do you see any way this suggestion break any existing functionality?

    happy to move this to email or chat if you like
     

Share This Page