Hi @Arkogelul, you can do that kind of work. One possibility would be to create a script that iterate through all open sprites and then all tags of that sprite. For each tag you can change its Tag.name property.
local sprite = app.activeSprite
local name1 = tag.name:match('^(.+)bad$')
local badTagName = nil
if name1 then
badTagName = tag.sprite.tags[name1 .. " bad"]
end
local function modifyTag(1)
tag.name = " good"
end
if badTagName then
modifyTag(badTagName)
end
That obviousely didn’t work. I gathered some piece of code here and there, not at random, but not really knowing if it fits together. It gives me this error :
attempt to index a nil value (global'tag')
Basically, I would like to look for a particular string in the tag name, and if the string is in the tag name, change it with another one.
adult_char_down
change the word ‘adult’ for the word ‘kid’ would give kid_char_down
Thanks a lot, once again.
I found a solution that works
local sprite = app.activeSprite
for i, tag in ipairs(sprite.tags) do
local name = tag.name
tag.name = (string.gsub(name, "old string", "new string"))
end
I don’t mind at all. The final script is in my last post. I’m planning to improve it a bit though. I’d like to add an interface and the ability to add a string before or after. I don’t how to deal with the interface yet. I will have to check on this.