Logic Machine Forum
Finde and replace function? - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2)
+--- Thread: Finde and replace function? (/showthread.php?tid=1250)



Finde and replace function? - BuildingAutomation - 23.02.2018

Hi LM community!

Just wondering if there is any way to mass edit the object name in the objects tab of the LM5? I want to change part of the name, like the find and replace tool in ETS.


B.R
BA


RE: Finde and replace function? - Erwin van der Zwart - 23.02.2018

Hi,

Change the names in the ETS and paste the new ESF export data into the beginning from this script and run once. This will update the names to the new names in the ESF file data.

Make backup first (:

.lua   Update objectnames from ESF data inside DB.lua (Size: 1.46 KB / Downloads: 37)


BR,

Erwin


RE: Finde and replace function? - Thomas - 23.02.2018

I use this script for changing icons. Maybe it can help you in looking for the solution. Simply look for correct table.

oldicon = 'oldicon.svg'
newicon = 'newicon.svg'
db:query('UPDATE visobjects SET params=replace(params,?,?)', oldicon, newicon)


RE: Finde and replace function? - BuildingAutomation - 23.02.2018

Thank you for the replies, i am quite new to the lm/lua system. Could you explain where i add the script? Smile

BR,

BA


RE: Finde and replace function? - Thomas - 23.02.2018

It depends on your design. What I've done is I reserved a subgroup in my group objects list for testing and development purposes. This is the main storage for this kind of scripts. I suppose you to use data type 'bit' for these scripts because there's a bug in LM causing some other data types can't be run directly from the IDE.

The database structure is available here in forum in some different thread. Alternatively you can read it from the internal database directly. The process how to do it has been described here too.


RE: Finde and replace function? - admin - 23.02.2018

Do you have a reproducible example of "Run script" not working from editor?


RE: Finde and replace function? - Erwin van der Zwart - 23.02.2018

Hi,

I always use a resident script at 60 sec to execute special function scripts like this one. Just enable the script and disable it within 60 sec, but i always put script.disable(_SCRIPTNAME) at the end to have it self disabling.

I’m not aware of any bug here and think there is none ...

BR,

Erwin


RE: Finde and replace function? - BuildingAutomation - 26.02.2018

Thank you Erwin, your script worked great!!


BR,
BA


RE: Finde and replace function? - Thomas - 26.02.2018

(23.02.2018, 17:19)admin Wrote: Do you have a reproducible example of "Run script" not working from editor?

I'm sorry I can't repeat it now. Maybe the issue has been solved.