I got two glyph names and two names of layers. Want to open a new tab with these two glyphs, each in a specified layer, like /glyphA (Bold) /glyphB (Regular)
I was only able to open a new tab with without specifying layers:
Many thanks, Rainer!
Looks like there has to be a tab open, though. I’d like to create a new tab with a string and then apply layerIds to ranges of it …
Not sure I understand what you mean. What are you missing? You know how to open a tab, and now you also know how to apply layerIds to ranges. All the steps necessary for this are on this page.
This is not documented other than through Python's help() and dir() functions. And perhaps the .h files in the app package if you know your way around the PyObjC Bridge.
from PyObjCTools.AppHelper import callAfter
f = Glyphs.font
word = 'Hello’
callAfter( Glyphs.currentDocument.windowController().addTabWithString_, word )
In Glyphs 2, I changed the behavior of scripts a bit. As long as you don’t use dialogs the script will run in the main thread to avoid the need for callAfter().