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.

adding tags to group addresses that have no tag
#1
Hi,

I've made a little script that searches for a string on addresses with the tags 'CL'. Then I replace a string with another and and want to add 'AUTO' tag to those adresses that have no tags from before. addresses with RT_MODE has the tag 'CL' and addresses with LL_COLORVAL does not have any tag

The script works, but not allways. So if theres alot of addresses that doesn't have a tag like 70-90% of them gets the tag. Can anyone see through my script and see if its any issues with it?

Code:
myobjects = grp.tag('CL')
--log(myobjects[1])


for index, value in pairs(myobjects) do
  if string.find(value.name, 'RT_MODE') then
    b = string.gsub(value.name, "RT_MODE", "LL_COLORVAL")
    x = grp.find(b)
    if x.tagcache == '' then grp.addtags(b, 'AUTO') end   
  end
end
Reply
#2
Check Error logs. If x object cannot be found you will get an error. I would change it like this:
Code:
if x and not string.find(x.tagcache or '', 'AUTO') then
  grp.addtags(b, 'AUTO')
end
Reply


Forum Jump: