I’m writing a script that exports all created instances of all currently open files to a chosen location. My idea is to present a modal dialogue to the user by calling
GetFolder() and set the returned value as a parameter to the
instance.generate() method. Here is the source code (also on Github):
folderPath = GetFolder(message=None, allowsMultipleSelection = False) for font in Glyphs.fonts: for instance in font.instances: instance.generate(FontPath = folderPath) Glyphs.showNotification('Export All Instances', 'Export successful.')
Running the script generates the following error message in the macro panel:
Traceback (most recent call last): File "exportAllInstances.py", line 8, in <module> folderPath = GetFolder(message=None, allowsMultipleSelection = False) File "/Applications/Glyphs.app/Contents/Scripts/GlyphsApp.py", line 2787, in GetFolder Panel = NSOpenPanel.openPanel().retain() objc.error: NSInternalInconsistencyException - not running on AppKit (main) thread
My hunch was this is some dependency issue as I’m on Glyphs 1.4.4, but I was told Glyphs 2.3 generates the very same error. Is this due to a misuse of the method on my part, or is
GetFolder() simply not implemented? How can I make it work?