Rename a glyph via scripting

Hello,
How do I rename a glyph via scripting.

I want to append “.liga” to the current open glyph or selected glyphs.

Thanks.

You don’t need to script that; it’s something you can do by default. Select glyphs, open Search and Replace (shift-command-F). You empty the search field which indicates that you want to add stuff at the end, and type ‘.liga’ in the replace field.

@Tosche Thanks for the reply.

I’m aware of Search and Replace functionality.
Would like to learn the scripting way of doing it as well.

Thanks.

In that case, here’s the code:

for l in Glyphs.font.selectedLayers:
	l.parent.name += '.liga'
2 Likes

Thank you very much for the answer.