Thanks, I checked this repo but I wondered if there wasn’t an easier way…
I tried a small script using the method in the repo.
# encoding: utf-8
Created by Georg Seifert on 2016-10-13.
Copyright (c) 2016 schriftgestaltung.de. All rights reserved.
import sys, os
from Glyphs import *
from Foundation import NSURL, NSString
path = "../../file.glyphs"
doc = Glyphs.openDocumentWithContentsOfFile_display_(path, False)
font = doc.font()
for glyph in font.glyphs():
It’ work but only if Glyphs 3 is open, do you know if it’s possible to run it without Glyphs 3 App open ?
Some of Glyphs 3 Python API are present in glyphsLib module.
from glyphsLib import GSFont, GSLayer
font = GSFont(path=".../.../file.glyphs")
exportedGlyphs = 
for glyph in font.glyphs:
if glyph.export == True:
You can use glyphLib but also use the remote scripting. The later requires that you open the font in Glyphs but that can be done from the script and doesn’t neet to open the UI. In the remote scripting environment, the scripting wrapper doesn’t work so you need to use the native objectiveC API. That mostly means that you have parents at properties (font.glyphs() vs font.glyphs) and some longer accessor methods (e.g. glyph.layerForId_(layerID) vs glyph.layers[layerID]).
That is an interesting approach. There is one downside. All output from the script shows up in the macro window and not in the context of where you run the script.
Here is a sample code if someone what’s to try:
You’re right, it’s too bad we can’t get the output directly. (It looks like macroViewController.macroText is not available, but that may not mean what I guess it means). But if we can run scripts the way you just described… I wonder if variables and state persist the way they do while in the macro editor. E.g, can I run part of a script with runMacroString_ then print something to the console, then run more of the script with another call to runMacroString_, etc