Example #1
0
 def updateStatus(self, info):  
     
     glyph = CurrentGlyph()
     
     if glyph is None:
         font = CurrentFont()
         if font is None:
             message = "Im just looking around"
         else:
             m = self.parseFontInfo(font)
             message = "Im working on my %s in RoboFont" % m
     else:
         font = glyph.getParent()
         m = self.parseFontInfo(font)
         message = "Im drawing glyph %s for %s in RoboFont" % (glyph.name, m)
     
     cmd = NSAppleScript.alloc().initWithSource_(appleScript % message)
     cmd.executeAndReturnError_(None)
Example #2
0
    def execute_applescript_command(cls, cmd):
        """
        Executes applescript command.

        :param str | list[str] cmd: command or commands that should be
        executed.
        :rtype: AppleEventDescriptor
        :return: AppleEventDescriptor with result of executed command.
        """
        cmd = '\n'.join([cmd] if isinstance(cmd, basestring) else cmd)

        script = NSAppleScript.alloc().initWithSource_(cmd)
        result = script.executeAndReturnError_(None)

        if not result[0]:
            error_message = 'Error when executing applescript command: %s' %\
                            result[1]['NSAppleScriptErrorMessage']
            raise TooSaltyUISoupException(error_message.encode('utf-8',
                                                               'ignore'))

        return AppleEventDescriptor(result[0])
Example #3
0
def doscript(x):
    from AppKit import NSAppleScript
    res = NSAppleScript.alloc().initWithSource_(x)\
        .executeAndReturnError_()
    if not res[1]: return res[0]
    raise AppleEventError(res[1])
Example #4
0
def doscript(x):
    from AppKit import NSAppleScript
    res = NSAppleScript.alloc().initWithSource_(x)\
        .executeAndReturnError_()
    if not res[1]: return res[0]
    raise AppleEventError(res[1])