This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Wildcard for activation of scripts
#1
Hi all,

I am using a lot of little scripts for presence simulation. Up to now I have to manually activate all those scripts before I go on holiday. Alternatively I could write a script as follows to enable all simulation scripts, but that would mean typing in approx. 100 lines manually.

Code:
script.enable('Simulation 1: Entrance on')
script.enalbe('Simulation 1: Office on')
...

Since all the scripts start with the word "Simulation": Is it possible to use a wildcard to enable/disable all scripts that start with "Simulation", something like

Code:
script.enable('Simulation*')

?

Many thanks and best regards
RSV4
Reply
#2
thanks for a suggestion!
There is such thing as Category in Scripts. In the upcoming firmware we will implement enable/disable of Category which will relieve plenty of code Smile
Reply
#3
Hi Edgars

Many thanks for your quick reply, therefore I will wait for the new firmware. Any plan for the release date?

Great idea with the forum!

Many thanks
RSV4
Reply
#4
Hi,

In the meantime you could create a table of the script names and then parse the table with loop to enable\disable them.



Code:
local myscripts = {"script a","script b","Event for 12/0/1"}

function enablescripts()
  for i in pairs(myscripts) do
    script.enable(myscripts[i])
  end
end

function disablescripts()
  for i in pairs(myscripts) do
    script.disable(myscripts[i])
  end
end

-- to disable
disablescripts()

-- to enable
enablescripts()


Thanks,

Roger
Reply
#5
Hi Robin,
we expect it this/next week.
Reply
#6
Hi Roger,

thank you for the code. This unfortunately would also mean typing in all the script names and having to update them manually as soon as I add/remove a script from my simulation.

Since it is only a week or two wait, the new firmware will be available before my next holidays :-)

@Edgars: Wow, did not expect it that soon, great!

Best regards,
Robin
Reply
#7
You don't need to type the scripname (or other) manualy, just select them in the pulldown box from the panel on the right side of your script.
Reply
#8
Have not tried that yet, thank you. But that will still require to maintain the array of names manually when I add/delete scripts.
Reply
#9
(06.07.2015, 12:32)edgars Wrote: thanks for a suggestion!
There is such thing as Category in Scripts. In the upcoming firmware we will implement enable/disable of Category which will relieve plenty of code Smile

Hi Edgars

Is this implemented in the just released beta firmware 2015.08.07? If yes, what's the lua code to enable/disalbe a script category?

Best regards,
Robin
Reply
#10
Hey Robin!

Try the following functions:
 
Code:
script.categoryenable(category)



Code:
script.categorydisable(category)
Reply
#11
Hi Edgars!

I've tried script.category.enable, script.enable(category) and a lot of others but did not come up with 'categoryenable' in one word  Blush 

Could you include these two commands in the script code examples in the new firmware? I did not see them in the beta version. Thanks a lot!

BTW: Is there a complete list of all LM script commands available, meaning everything 'outside' the standard lua language such as the commands above?

Best regards,
Robin
Reply
#12
Quote:BTW: Is there a complete list of all LM script commands available, meaning everything 'outside' the standard lua language such as the commands above?
That would be grate Smile
Reply
#13
Hi Edgars

I have no success with the follwing code:
Code:
-- activate/deactivate all scripts for presence simulation

-- get value that triggered this script
evval = event.getvalue()

-- activate/deactivate scripts
if evval == true then
 script.categoryenable('Simulation')
else
 script.categorydisable('Simulation')
end

Scripts with the category "Simulation" do not change their status at all, even on shift-refreshing the browser. The "Active" bulb stays the way it was.


Any hints?

Best regards,
Robin
Reply
#14
We'll do some tests soon and will let you know of the results.
Reply
#15
Hi all,
is there any news on this one?
Best regards,
Robin
Reply
#16
Yes, it should work in new release. We will be releasing new batch of firmwares soon, stay tuned Smile
Reply
#17
Great, thank you!
Reply
#18
Works like a charm with the firmware you released later this day (tested on LM3:Reactor)! You guys are great, thank you so much!

For readers of this thread: My script above works if you like to use it as well.
Reply


Forum Jump: