Is this possible?

Is this possible:

I want to mark a selected number of glyphs, like for instance A, B, C, one, two and &.

With a click I want to open a new tab and put these (and only these) with a H between them, as a reference.

This is possible with a simple Python script:

#MenuTitle: Open Tab with H in Between # -*- coding: utf-8 -*- """Takes the selected glyphs, opens a tab with them, but puts an H between them.""" import GlyphsApp inBetweenGlyphName = "/H" Font = Glyphs.font selectedGlyphNames = [ "/" + l.parent.name for l in Font.selectedLayers ] tabText = inBetweenGlyphName + inBetweenGlyphName.join( selectedGlyphNames ) + inBetweenGlyphName Glyphs.currentDocument.windowController().addTabWithString_( tabText )

Save this as a .py file in your Scripts folder. You can set a shortcut in the System Prefs.

Oh, thanks so much! I need to learn Python.

i recently made a similar thing, get it here:
https://github.com/DeutschMark/Glyphsapp-Scripts/tree/master

it opens a tab with the selected glyphs and adds a line of HHHHOO (while * is the placeholder). you can change that string in the user interface, or in the code (for lower case, or other reference strings).

feel free to improve the code, might be messy but it works :slight_smile:

You can start right now: http://www.glyphsapp.com/tutorials/tag/scripting :-)

Mark: Woah, that is cool. Thanks.
Rainer: Thanks for that, will definitely have a look. Learning Python have been on my list for some time now.

Both works, that is super!

However, with you script Rainer (which is exactly what I need) I have a similar issue like had before with some scripts for Glyphs app.

What happens is this. The script opens a Tab but a sort of “hidden” one. The tab can be closed but only with a short command, there is no checkbox.

Afterwards “grey area” in the Glyphs interface suddenly pops up.

See this film and you’ll see what I mean. The functionality is super however :slight_smile:

http://quick.as/nlqtdbw

your welcome. i just shortened the menu title, so it doesn’t take all the space in the scripts menu

Workaround until I can fix it: keep at least one other tab open, so the tab bar shows.

Here is a fixed version of the script:

#MenuTitle: Open Tab with H in Between

-- coding: utf-8 --

“”“Takes the selected glyphs, opens a tab with them, but puts an H between them.”""
import GlyphsApp

from PyObjCTools.AppHelper import callAfter

inBetweenGlyphName = "/H"
Font = Glyphs.font
selectedGlyphNames = [ “/” + l.parent.name for l in Font.selectedLayers ]
tabText = inBetweenGlyphName + inBetweenGlyphName.join( selectedGlyphNames ) + inBetweenGlyphName

callAfter(Glyphs.currentDocument.windowController().addTabWithString_, tabText)

Thank you so much! You guys are great.