Show Next & Previous Instance for Preview Panel Window

How to make a script like this one https://github.com/mekkablue/Glyphs-Scripts/blob/master/Masters/Show%20next%20instance.py but for preview panel window?

bump :slight_smile:

looks a bit hacked but works:

from Foundation import NSApplication
PreviewPanel = None
for p in NSApplication.sharedApplication().delegate().valueForKey_("pluginInstances"):
	if p.__class__.__name__ == "NSKVONotifying_GlyphsPreviewPanel":
		PreviewPanel = p
		
if PreviewPanel:
	PreviewPanel.setSelectedInstance_(IndexOfInstance)
1 Like

Edit:
Thanks! :smiley:

How can I detect whether I have the preview panel, or preview window open, and run the script only for that?

Take a look at the if clauses in the code sample above. It checks if the panel is open.

No, it just checks if the PreviewPanel Plugin is loaded. I commented on github.

I updated the scripts so that both the bottom area and the window will stay in sync. Thx for your input @oneweioranother.