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.

Finde and replace function?
#1
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
Reply
#2
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
Reply
#3
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)
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#4
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
Reply
#5
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.
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#6
Do you have a reproducible example of "Run script" not working from editor?
Reply
#7
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
Reply
#8
Thank you Erwin, your script worked great!!


BR,
BA
Reply
#9
(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.
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply


Forum Jump: