Page 1 of 1

List the variables in a folder?

PostPosted: Mon Jul 31, 2017 3:50 am
by racarter
Python question:

Other than checking all variables and seeing which folder they're in, is there a more elegant way of getting a list of all the variables in a folder?

Re: List the variables in a folder?

PostPosted: Mon Jul 31, 2017 6:00 am
by DaveL17
racarter wrote:
Python question:

Other than checking all variables and seeing which folder they're in, is there a more elegant way of getting a list of all the variables in a folder?

There's probably several ways to do this, but here's one way:

Code: Select all
for thing in indigo.variables.iter():
   if thing.folderId == 1863978771:
      indigo.server.log(unicode(thing.name))

Re: List the variables in a folder?

PostPosted: Mon Jul 31, 2017 7:09 am
by racarter
Thanks Dave - that's exactly how I did it. :)

Re: List the variables in a folder?

PostPosted: Mon Jul 31, 2017 9:40 am
by matt (support)
Yeah, there isn't an API or filter arg to do this elegantly currently so it has to be brute-force checked.

Re: List the variables in a folder?

PostPosted: Mon Jul 31, 2017 3:37 pm
by racarter
Thanks Matt :)