Logic Machine Forum
Wildcard for activation of scripts - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Wildcard for activation of scripts (/showthread.php?tid=19)



Wildcard for activation of scripts - RSV4 - 06.07.2015

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


RE: Wildcard for activation of scripts - edgars - 06.07.2015

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


RE: Wildcard for activation of scripts - RSV4 - 06.07.2015

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


RE: Wildcard for activation of scripts - rocfusion - 06.07.2015

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


RE: Wildcard for activation of scripts - edgars - 06.07.2015

Hi Robin,
we expect it this/next week.


RE: Wildcard for activation of scripts - RSV4 - 06.07.2015

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


RE: Wildcard for activation of scripts - Erwin van der Zwart - 10.07.2015

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.


RE: Wildcard for activation of scripts - RSV4 - 20.07.2015

Have not tried that yet, thank you. But that will still require to maintain the array of names manually when I add/delete scripts.


RE: Wildcard for activation of scripts - RSV4 - 10.08.2015

(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


RE: Wildcard for activation of scripts - edgars - 11.08.2015

Hey Robin!

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



Code:
script.categorydisable(category)



RE: Wildcard for activation of scripts - RSV4 - 11.08.2015

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


RE: Wildcard for activation of scripts - Pawel - 11.08.2015

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


RE: Wildcard for activation of scripts - RSV4 - 11.08.2015

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


RE: Wildcard for activation of scripts - admin - 12.08.2015

We'll do some tests soon and will let you know of the results.


RE: Wildcard for activation of scripts - RSV4 - 31.08.2015

Hi all,
is there any news on this one?
Best regards,
Robin


RE: Wildcard for activation of scripts - admin - 31.08.2015

Yes, it should work in new release. We will be releasing new batch of firmwares soon, stay tuned Smile


RE: Wildcard for activation of scripts - RSV4 - 31.08.2015

Great, thank you!


RE: Wildcard for activation of scripts - RSV4 - 31.08.2015

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.