<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Detect unsaved changes via script]]></title><description><![CDATA[<p dir="auto">I often want to switch from one batch of UFOs to another, without manually closing glyphs, space centers, and font views of 4, 6, or more masters.</p>
<p dir="auto">So, I made a simple script:</p>
<pre><code>for font in AllFonts():
    font.close()
</code></pre>
<p dir="auto">However, this doesn't prompt me to save unsaved changes, so it's currently risky to use. I've searched around for how to detect unsaved changes, but I haven't found the answer yet. Is there some kind of method to check the saved state of open fonts? Alternatively, if it is required to string together observers to check this, is there some combination that would help check for unsaved changes? What I'd ultimately like is a script like this...</p>
<pre><code>### The script I want, but don't quite have 

from mojo.UI import dontShowAgainMessage

unsavedFonts = []

for font in AllFonts():
    fontName = font.info.familyName + " " + font.info.styleName

    if font.isSaved() is False: #### ✴️ this is what I'd like to check ✴️ ####
        unsavedFonts.append(fontName)
        
    else:
        font.close()
    
unsavedMessage = "There are unsaved changes in " + unsavedFonts + ". Please close them manually."

dontShowAgainMessage(messageText='Unsaved changes', informativeText=unsavedMessage, alertStyle=1, parentWindow=None, resultCallback=None, dontShowAgainKey='')
</code></pre>
<p dir="auto">Thanks for any pointers!</p>
]]></description><link>https://forum.robofont.com/topic/482/detect-unsaved-changes-via-script</link><generator>RSS for Node</generator><lastBuildDate>Sun, 14 Jun 2026 10:51:36 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/482.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 13 Jun 2018 16:03:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Detect unsaved changes via script on Thu, 14 Jun 2018 11:15:21 GMT]]></title><description><![CDATA[<p dir="auto">I often want to switch from one batch of UFOs to another, without manually closing glyphs, space centers, and font views of 4, 6, or more masters.</p>
<p dir="auto">So, I made a simple script:</p>
<pre><code>for font in AllFonts():
    font.close()
</code></pre>
<p dir="auto">However, this doesn't prompt me to save unsaved changes, so it's currently risky to use. I've searched around for how to detect unsaved changes, but I haven't found the answer yet. Is there some kind of method to check the saved state of open fonts? Alternatively, if it is required to string together observers to check this, is there some combination that would help check for unsaved changes? What I'd ultimately like is a script like this...</p>
<pre><code>### The script I want, but don't quite have 

from mojo.UI import dontShowAgainMessage

unsavedFonts = []

for font in AllFonts():
    fontName = font.info.familyName + " " + font.info.styleName

    if font.isSaved() is False: #### ✴️ this is what I'd like to check ✴️ ####
        unsavedFonts.append(fontName)
        
    else:
        font.close()
    
unsavedMessage = "There are unsaved changes in " + unsavedFonts + ". Please close them manually."

dontShowAgainMessage(messageText='Unsaved changes', informativeText=unsavedMessage, alertStyle=1, parentWindow=None, resultCallback=None, dontShowAgainKey='')
</code></pre>
<p dir="auto">Thanks for any pointers!</p>
]]></description><link>https://forum.robofont.com/post/1632</link><guid isPermaLink="true">https://forum.robofont.com/post/1632</guid><dc:creator><![CDATA[StephenNixon]]></dc:creator><pubDate>Thu, 14 Jun 2018 11:15:21 GMT</pubDate></item><item><title><![CDATA[Reply to Detect unsaved changes via script on Thu, 14 Jun 2018 07:42:14 GMT]]></title><description><![CDATA[<p dir="auto">you can use:</p>
<pre><code class="language-python">f = CurrentFont()

document = f.document()
edited = None
if document:
    # only font objects with ui has a document object
    edited = document.isDocumentEdited()

print(edited)
</code></pre>
<p dir="auto">but this is good candidate to be added to fontParts</p>
]]></description><link>https://forum.robofont.com/post/1633</link><guid isPermaLink="true">https://forum.robofont.com/post/1633</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Thu, 14 Jun 2018 07:42:14 GMT</pubDate></item><item><title><![CDATA[Reply to Detect unsaved changes via script on Thu, 14 Jun 2018 07:49:05 GMT]]></title><description><![CDATA[<p dir="auto">also see <a href="https://github.com/robofab-developers/fontParts/issues/310" rel="nofollow">https://github.com/robofab-developers/fontParts/issues/310</a></p>
]]></description><link>https://forum.robofont.com/post/1634</link><guid isPermaLink="true">https://forum.robofont.com/post/1634</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Thu, 14 Jun 2018 07:49:05 GMT</pubDate></item><item><title><![CDATA[Reply to Detect unsaved changes via script on Thu, 14 Jun 2018 09:49:24 GMT]]></title><description><![CDATA[<p dir="auto">Oops; nevermind!</p>
<p dir="auto">Just found out that macOS has a built-in feature to do this exact thing.</p>
<p dir="auto">Just use the shortcut <code>option + command + w</code>.</p>
]]></description><link>https://forum.robofont.com/post/1636</link><guid isPermaLink="true">https://forum.robofont.com/post/1636</guid><dc:creator><![CDATA[StephenNixon]]></dc:creator><pubDate>Thu, 14 Jun 2018 09:49:24 GMT</pubDate></item></channel></rss>