Copying the List View

I would like to be able to highlight entries in List View and be able to copy the entire line(s) of information to TextMate but I cannot find a way to do this. Do we perhaps have a script for this, or can it be enabled in the app?

This is a very simple Python script and in fact described in this introductory tutorial:
https://www.glyphsapp.com/tutorials/scripting-glyphs-part-1

Thanks Eric. So now, since I am not a Python programmer, let me ask: if I want to print only a range of ID numbers, for instance 1000 through 1090, how should the following code be modified to do that?

for myGlyph in Glyphs.font.glyphs:
print myGlyph.name, myGlyph.category, myGlyph.subCategory, myGlyph.unicode

What do you mean by ID numbers? Just count from 1000 and put it in the line next to the glyph information?

You add count=1000 At the top and inside the loop you add a count += 1 (the += operator adds what is on its right side to the variable on the left). And of course, you a count At a convenient place in the print statement.

In List view, the very first column header is “ID”.

Now, as I said I’m not a programmer, to my question? Bearing that in mind, a general explanation as to how to write it isn’t helpful at all.

What do you need the ID for? It is just the order number inside the font file. You can access it by glyph.glyphId(), and you can define a range with brackets after the list name, like this:

for myGlyph in Glyphs.font.glyphs[1000:1090]:
    print myGlyph.glyphId(), myGlyph.name, myGlyph.category, myGlyph.subCategory, myGlyph.unicode

This is called slicing. [50:] means from 50 to the end, [:50] everything from the beginning until the fiftieth item.

You don’t need to be a programmer. Getting started with some Python scripting is easy. Give it a try, it will come in handy very often.

1 Like

I don’t need the ID; it’s just a convenient way to reference the range of glyphs.

I don’t think scripting is much different than programming. I understand it would be helpful for me to know how to do it, but learning it takes time, which I always seem to be short of.

Thanks for the code; that’s just what I need.

Scripting is simimilar to programming but much easier. Learning to write scripts, takes a few hours. Learning to program a few month. Have a look at the python tutorials on our website.