Arrays

35 views
Skip to first unread message

Shadowwoelf

unread,
Dec 22, 2011, 5:07:45 PM12/22/11
to Tasker
Any possibility of having arrays in Tasker?

I am trying to get a random image file to be my wallpaper. I am able
to select all the files in my wallpaper folder, but it puts all the
information into 50 different variables named %WALLPAPERS.

This would even work if I could do %WALLPAPERS[%RANDOMVARIABLE].

Tye

unread,
Dec 22, 2011, 11:12:56 PM12/22/11
to tas...@googlegroups.com
Arrays exist. I don't have the link handy but you can find a good explanation in the variables section of the documentation.

Pent

unread,
Dec 23, 2011, 4:34:28 AM12/23/11
to Tasker
> This would even work if I could do %WALLPAPERS[%RANDOMVARIABLE].

%WALLPAPERS(%RANDOMVARIABLE)

I recommend using local (lower-case) variables though, unless you want
to use them between-tasks. So:

%wallpaper(%randomvariable)

Pent

TW

unread,
Feb 23, 2012, 4:36:50 AM2/23/12
to tas...@googlegroups.com
Hi Pent,

I'm trying something similar but it the only way I seem to be able to get the content of an array is using Array Pop which I don't want because it will also remove it from the array..

As test I'm doing the following
Var Set %arr to "this is a test for an array"
Var Split %arr
Var Set %arrpos to %arr(#?*es*)
Flash: %arrpos %arr(%arrpos)
this results in 4 %arr0
while I would expect it to return 4 test

Pent

unread,
Feb 23, 2012, 5:55:32 AM2/23/12
to Tasker
> Var Set %arr to "this is a test for an array"
> Var Split %arr
> Var Set %arrpos to %arr(#?*es*)
> Flash: %arrpos %arr(%arrpos)
> this results in 4 %arr0
> while I would expect it to return 4 test

I get '4 test', maybe check your spelling ?

BTW, note that %arrpos could look like: 4,5,9 if there were more
matches, then doing %arr(%arrpos) wouldn't make sense.

Pent

TW

unread,
Feb 23, 2012, 6:10:24 AM2/23/12
to tas...@googlegroups.com
are you using the latest beta? :)

I have the example as above and checked my spelling, all seems good except the result..
I'll send this test Task through mail..

Pent

unread,
Feb 23, 2012, 6:27:08 AM2/23/12
to Tasker
You have a space on the end of the To parameter when setting %arrpos.

Now you see why I strip spaces wherever possible :-)

I'll strip spaces from array indices, should catch this in future.

Pent

TW

unread,
Feb 23, 2012, 6:33:59 AM2/23/12
to tas...@googlegroups.com
damn you autocomplete feature! :)
I tested this twice in 2 different Tasks and my keyboard added a space everytime.

Thanks for looking at it, now it works great!

V Oz

unread,
Feb 23, 2012, 9:01:29 AM2/23/12
to tas...@googlegroups.com
BTW, can't run For over slice of 2-D array:(
For %item Items %Array (%iii) () doesn't work
For %item Items %Array1() works well

Flash  %Array (%iii) (%jjj) works very well :)
Reply all
Reply to author
Forward
0 new messages