WikiD Instructables

Arrays

WIP: This is the original documentation

Input Arrays

Arrays used here will be treated as values pertraining to a single entity. For example, if you use %name()|%age() it should mean that you have a list of people and that those 2 arrays represent the names and ages for each person, where %name1 is related to %age1, %name2 is related to %age2, etc. This means that when you perform any action on them, all of them will keep their relations intact. For example, if you have the %names() array with the values John,Anne and the %ages() array with 23,17 that means that John is 23 and Anne is 17. If you sort these by name, the resulting arrays will be Anne,John and 17,23. As you can see the first name is still related to the first age, and the second name is still related to the second age. You can input multiple arrays either by hand like for example 1,2,3|a,b,c or by using Tasker variables like for example %numbers()|%letters(). Both will function equally. You can change the separator of individual array items (, in the example) in the Item Separator field. You can change the separator for arrays (| in the example) in the Input Arrays Separator field.

Vertical Mode

This is easier to explain with an example: If this option is NOT selected, your input can be something like the %names() array with the values John,Anne and the %ages() array with 23,17. If this option IS selected, your input can be something like the %john() array with the values John,23 and the %anne() array with Anne,17. This is useful to read CSV files for example in which each line of the file will have the vertical format.

Input Arrays Selector

Output

Names

Name your output arrays. If left blank, then AutoTools will try to get variable names from the Input Arrays. If no variables were used in the Input Arrays field you'll need to manually set them here. ATTENTION: If the output arrays have the same names as the input arrays and the output arrays have LESS elements than the input arrays, then the last elements of the arrays will still retain their old values. In other words, AutoTools can't make arrays shorter then they originally are, so if you want to do that you HAVE to use different names here.

Join Output Arrays

Sometimes you want the output arrays to be joined with some special characters like =:= for example. You could do it with a Tasker action after using this action, but it's easier to just join them here saving you an extra step. PRO-TIP: If the output arrays have commas in their values you should always join the arrays with a different separator or else it will be hard to differentiate real commas from commas that simply separate array elements.

Sorting

Sort Arrays

As mentioned above, sorting arrays will keep their relative positions. Check the Input Arrays section. Sorting will always be applied to the first array. For example if you want to sort a list of people by name the Input Arrays should be %names()|%age() but if you want to sort by age the input should be %age()|%name(). Invert And Randomize As usual when these are applied relative order between arrays will be maintained. If Randomize is selected, both Sort Arrays and Invert options will be ignored.

Removing/Adding

Pop Position

Remove items from the input arrays before any items are added into the arrays with the Push option. For example, setting this to 1,2 will remove the first 2 items from each array. ATTENTION: because this option removes elements from arrays make sure to use different names for input and output arrays. More info above.

Push

Add one or more items into each array.

For example if your input arrays are John,Anne|24,17, meaning that you have a names array and an ages array where , separates each item and | separates each array, you can insert 2 new people very easily by setting this value to Michael,Fred|65,10 for example. The resulting %name() array would be John,Anne,Michael,Fred and the %age() array would become 24,17,65,10. Push Position By default items will be added to the end of the input arrays, but if you set this to 1 for example, it'll add items to start of the arrays.

Merging

Merge Arrays

Use this option to merge all the input arrays into one. For example, you may want to print out each person's name and age. If your input arrays are John,Anne|24,17 and you merge them you'll get a sigle output array where the first element is John24 and the second element is Anne17 You may wish to make this output prettier. Use the other merge options below for that.

Merged Array Joiner

Simple way to make each item be separated by something in the output array. For example if you use the names and ages input above and set the joiner to is you'll get a sigle output array where the first element is John is 24 and the second element is Anne is 17

Merge Format

More powerful alternative to the simple Array Joiner For example if you use the names and ages input above and set the merge format to {0} is {1} years old. you'll get a sigle output array where the first element is John is 24 years old. and the second element is Anne is 17 years old.

Join Merged Arrays

You can further merge the output arrays to get a single variable with all the ouput For example if you use the names and ages input above and set the Merge Format to {0} is {1} years old. and the Join Merged Arrays field to a newline character (by pressing enter on your keyboard) you'll get a sigle output variable with the value John is 24 years old. Anne is 17 years old. This is very useful to quickly format any arrays into a format you may want to use in scenes, widgets, notifications, etc.

Filtering

ATTENTION: because these options remove elements from arrays make sure to use different names for input and output arrays. More info above.

Unique

Remove items from arrays depending on the uniqueness of items in the first array. For example if your input arrays are John,Anne,John|24,17,54 and you select this option the output will be John,Anne|24,17

Filter

Filter the first array and remove corresponding elements from other arrays. Check the Input Arrays section for more info on maintaing array relations.

Keep Only New

If you use this option AutoTools checks the last time it was used with the same name and only keeps elements that are different. For example consider that your input arrays are John,Anne|24,17 and you set the Keep Only New Name option to new people. If you run the task for the first time, the output will still be John,Anne|24,17. If you run the task for the second time with the same input, the output will be empty because there are no new values in the arrays since the first time it ran. If you run it a third time with the input set to John,Anne,Fred|24,17,64, then the output will be Fred|64 which is the only new data in the arrays. This can be useful if you want to check if a certain website has any new stuff for example.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies