Hello,
Is there any possible way to update and activate smart filter by script? Though I tried to search any threads related to this, I couldn’t find.
I would like to write a script like below process.
I made a smart filter like below.
<dict>
<key>name</key>
<string>mySmartFilter</string>
<key>predicate</key>
<string>name CONTAINS "A"</string>
</dict>
then,
search a specific smart filter with name. (above case ’ mySmartFilter ')
change its predicate(above case name CONTAINS "A"
) into name beginswith "E"
.
activate(select) this smart filter.
Thanks in advance.
Have a look a the source code of the Color Flow plugin.
Hello,
Thanks for your advice.
I’ve look the source code of it, but I couldn’t find the ‘activating the smart filter by scripting.’
The reason why I asked it is… I just want to update custom glyph order from time to time or continuously.
for instance, [‘x’,‘y’,‘z’] to [‘a’,‘b’,‘c’] and to [‘e’,‘f’,‘g’]… with one click.
When I tried your code below, it worked fine for one time.
GSSortDescriptorNameList = objc.lookUpClass("GSSortDescriptorNameList")
font = Glyphs.font
glyphsArrayController = font.fontView.glyphsArrayController()
sortDescriptor = GSSortDescriptorNameList.alloc().initWithKey_ascending_("name", True)
sortDescriptor.setReferenceList_(["z", "y", "x"])
glyphsArrayController.setSortDescriptors_([sortDescriptor])
But when I tried another glyph order, it doesn’t worked. I have to click other selection in the sidebar.
That’s why I asked activating the filter by script.
Is there possible way I can update glyph order every time I run a script?
Thanks in advance.
Can you explain what you what to achieve with this? (Not what you are trying to do to get there)
Hello,
I just want to update glyph order for my own on changing my selection.
Thanks,
Daekwon_Kim:
GSSortDescriptorNameList = objc.lookUpClass("GSSortDescriptorNameList")
font = Glyphs.font
glyphsArrayController = font.fontView.glyphsArrayController()
sortDescriptor = GSSortDescriptorNameList.alloc().initWithKey_ascending_("name", True)
sortDescriptor.setReferenceList_(["z", "y", "x"])
glyphsArrayController.setSortDescriptors_([sortDescriptor])
Add this glyphsArrayController.setSortDescriptors_([])
befor the last line. That is a strange quirk of NSArrayController
GSSortDescriptorNameList = objc.lookUpClass("GSSortDescriptorNameList")
font = Glyphs.font
glyphsArrayController = font.fontView.glyphsArrayController()
sortDescriptor = GSSortDescriptorNameList.alloc().initWithKey_ascending_("name", True)
sortDescriptor.setReferenceList_(["z", "y", "x"])
glyphsArrayController.setSortDescriptors_([])
glyphsArrayController.setSortDescriptors_([sortDescriptor])
1 Like