Esempio n. 1
0
def nametoprefix(name):
	""" Used in osaglue and ASTranslate to generate default ObjC classname
		prefixes based on application and osax names.
		
		Notes:
		
		- Only characters A-Z and a-z are used.
		- If name contains two or more words, first character of first and second words are used.
		- If name contains one word, first character is used and second character is either
			first uppercase character found in rest of word, or first consonant found in rest 
			of word, or second character in word.
		
		- If unable to construct prefix by above rules for any reason, entire name is converted
			to standard objc-appscript identifier and first character is uppercased.
	"""
	try:
		words = ''.join(re.findall('([A-Za-z ])', name)).split()
		if len(words) > 1:
			word1, word2 = words[:2]
			return (word1[0] + word2[0]).upper()
		else:
			word = words[0]
			upper = re.findall('[A-Z]', word[1:])
			if upper:
				char = upper[0]
			else:
				char = re.findall('[^AEIOUaeiou]', word[1:])[0]
			return (word[0] + char).upper()
	except:
		prefix = getconverter('objc-appscript')(name)
		return prefix[0].upper() + prefix[1:]
Esempio n. 2
0
def _export(items, styles, plainText, singleHTML, frameHTML, options,
            outFolder, exportToSubfolders, progress):
    styleInfo = [(style, kStyleToSuffix[style]) for style in styles]
    # process each item
    for i, item in enumerate(items):
        name, path = item['name'], item['path']
        progress.nextitem(name, path)
        try:
            aetes = getaete(path)
            if not bool(aetes):
                progress.didfail(u"No terminology found.")
                continue
            for style, suffix in styleInfo:
                styleSubfolderName = exportToSubfolders and style or ''
                if not progress.shouldcontinue():
                    for item in items[i:]:
                        progress.didfail(u"User cancelled.")
                        progress.nextapp(item['name'], item['path'])
                    progress.didfail(u"User cancelled.")
                    progress.didfinish()
                    return
                if plainText:
                    outputPath = _makeDestinationFolder(
                        outFolder, styleSubfolderName, exportToSubfolders
                        and 'text', name + suffix + '.txt')
                    progress.nextoutput(u'%s' % outputPath)
                    f = file(outputPath, 'w')
                    try:
                        f.write('\xEF\xBB\xBF')  # UTF8 BOM
                        quickdoc.app(path, f, getconverter(style))
                    except:
                        f.close()
                        raise
                    f.close()
                if singleHTML or frameHTML:
                    terms = aeteparser.parseaetes(aetes, path, style)
                    if singleHTML:
                        outputPath = _makeDestinationFolder(
                            outFolder, styleSubfolderName, exportToSubfolders
                            and 'html', name + suffix + '.html')
                        progress.nextoutput(u'%s' % outputPath)
                        html = htmldoc.renderdictionary(terms, style, options)
                        f = open(outputPath, 'w')
                        f.write(str(html))
                        f.close()
                    if frameHTML:
                        outputPath = _makeDestinationFolder(
                            outFolder, styleSubfolderName, exportToSubfolders
                            and 'frame-html', name + suffix)
                        progress.nextoutput(u'%s' % outputPath)
                        htmldoc2.renderdictionary(terms, outputPath, style,
                                                  options)
        except Exception, err:
            from traceback import print_exc
            from StringIO import StringIO
            out = StringIO()
            print_exc(file=out)
            progress.didfail(u'Unexpected error:/n%s' % out.getvalue())
        else:
            progress.didsucceed()
Esempio n. 3
0
def nametoprefix(name):
	""" Used in osaglue and ASTranslate to generate default ObjC classname
		prefixes based on application and osax names.
		
		Notes:
		
		- Only characters A-Z and a-z are used.
		- If name contains two or more words, first character of first and second words are used.
		- If name contains one word, first character is used and second character is either
			first uppercase character found in rest of word, or first consonant found in rest 
			of word, or second character in word.
		
		- If unable to construct prefix by above rules for any reason, entire name is converted
			to standard objc-appscript identifier and first character is uppercased.
	"""
	try:
		words = ''.join(re.findall('([A-Za-z ])', name)).split()
		if len(words) > 1:
			word1, word2 = words[:2]
			return (word1[0] + word2[0]).upper()
		else:
			word = words[0]
			upper = re.findall('[A-Z]', word[1:])
			if upper:
				char = upper[0]
			else:
				char = re.findall('[^AEIOUaeiou]', word[1:])[0]
			return (word[0] + char).upper()
	except:
		prefix = getconverter('objc-appscript')(name)
		return prefix[0].upper() + prefix[1:]
Esempio n. 4
0
def exporttext(appname, style, optstr):
    opts, args = getopt(optstr, 'NHTs:cah')
    opts = dict(opts)
    out = StringIO()
    if _osaxpathsbyname.has_key(appname):
        appname = _osaxpathsbyname[appname]
    else:
        appname = aem.findapp.byname(appname)
    quickdoc.app(appname, out, getconverter(style))
    return out.getvalue()
Esempio n. 5
0
def exporttext(appname, style, optstr):
	opts, args = getopt(optstr, 'NHTs:cah')
	opts = dict(opts)
	out = StringIO()
	if _osaxpathsbyname.has_key(appname):
		appname = _osaxpathsbyname[appname]
	else:
		appname = aem.findapp.byname(appname)
	quickdoc.app(appname, out, getconverter(style))
	return out.getvalue()
Esempio n. 6
0
def _export(items, styles, plainText, singleHTML, frameHTML, options, outFolder, exportToSubfolders, progress):
	styleInfo = [(style, kStyleToSuffix[style]) for style in styles]
	# process each item
	for i, item in enumerate(items):
		name, path = item['name'], item['path']
		progress.nextitem(name, path)
		try:
			aetes = getaete(path)
			if not bool(aetes):
				progress.didfail(u"No terminology found.")
				continue
			for style, suffix in styleInfo:
				styleSubfolderName = exportToSubfolders and style or ''
				if not progress.shouldcontinue():
					for item in items[i:]:
						progress.didfail(u"User cancelled.")
						progress.nextapp(item['name'], item['path'])
					progress.didfail(u"User cancelled.")
					progress.didfinish()
					return
				if plainText:
					outputPath = _makeDestinationFolder(outFolder, styleSubfolderName, 
							exportToSubfolders and 'text', name + suffix + '.txt')
					progress.nextoutput(u'%s' % outputPath)
					f = file(outputPath, 'w')
					try:
						f.write('\xEF\xBB\xBF') # UTF8 BOM
						quickdoc.app(path, f, getconverter(style))
					except:
						f.close()
						raise
					f.close()
				if singleHTML or frameHTML:
					terms = aeteparser.parseaetes(aetes, path, style)
					if singleHTML:
						outputPath = _makeDestinationFolder(outFolder, styleSubfolderName, 
								exportToSubfolders and 'html', name + suffix + '.html')
						progress.nextoutput(u'%s' % outputPath)
						html = htmldoc.renderdictionary(terms, style, options)
						f = open(outputPath, 'w')
						f.write(str(html))
						f.close()
					if frameHTML:
						outputPath = _makeDestinationFolder(outFolder, styleSubfolderName, 
								exportToSubfolders and 'frame-html', name + suffix)
						progress.nextoutput(u'%s' % outputPath)
						htmldoc2.renderdictionary(terms, outputPath, style, options)
		except Exception, err:
			from traceback import print_exc
			from StringIO import StringIO
			out = StringIO()
			print_exc(file=out)
			progress.didfail(u'Unexpected error:/n%s' % out.getvalue())
		else:
			progress.didsucceed()
Esempio n. 7
0
 def __init__(self, style):
     self.convert = getconverter(style)
     # terminology tables; order is significant where synonym definitions occur
     self.commands = {}
     self.properties = []
     self.elements = []
     self.classes = []
     self.enumerators = []
     # use sets to record previously found definitions, and avoid adding duplicates to lists
     # (i.e. '(name, code) not in <set>' is quicker than using '(name, code) not in <list>')
     self._foundproperties = set()
     self._foundelements = set()
     self._foundclasses = set()
     self._foundenumerators = set()
     # ideally, aetes should define both singular and plural names for each class, but
     # some define only one or the other so we need to fill in any missing ones afterwards
     self._spareclassnames = {}
     self._foundclasscodes = set()
     self._foundelementcodes = set()
Esempio n. 8
0
	def __init__(self, style):
		self.convert = getconverter(style)
		# terminology tables; order is significant where synonym definitions occur
		self.commands = {}
		self.properties = []
		self.elements = []
		self.classes = []
		self.enumerators = []
		# use sets to record previously found definitions, and avoid adding duplicates to lists
		# (i.e. '(name, code) not in <set>' is quicker than using '(name, code) not in <list>')
		self._foundproperties = set()
		self._foundelements = set()
		self._foundclasses = set()
		self._foundenumerators = set()
		# ideally, aetes should define both singular and plural names for each class, but
		# some define only one or the other so we need to fill in any missing ones afterwards
		self._spareclassnames = {}
		self._foundclasscodes = set()
		self._foundelementcodes = set()
Esempio n. 9
0
def _export(items, styles, plainText, singleHTML, frameHTML, options, outFolder, exportToSubfolders, progress):
    styleInfo = [(style, kStyleToSuffix[style]) for style in styles]
    # process each item
    for i, item in enumerate(items):
        name, path = item["name"], item["path"]
        progress.nextitem(name, path)
        try:
            try:
                aetes = GetAppTerminology(path)
            except MacOSError, e:
                if e.args[0] != -192:
                    raise
                aetes = []
            if not bool(aetes):
                progress.didfail(u"No terminology found.")
                continue
            for style, suffix in styleInfo:
                styleSubfolderName = exportToSubfolders and style or ""
                if not progress.shouldcontinue():
                    for item in items[i:]:
                        progress.didfail(u"User cancelled.")
                        progress.nextapp(item["name"], item["path"])
                    progress.didfail(u"User cancelled.")
                    progress.didfinish()
                    return
                if plainText:
                    outputPath = _makeDestinationFolder(
                        outFolder, styleSubfolderName, exportToSubfolders and "text", name + suffix + ".txt"
                    )
                    progress.nextoutput(u"%s" % outputPath)
                    f = file(outputPath, "w")
                    try:
                        f.write("\xEF\xBB\xBF")  # UTF8 BOM
                        quickdoc.app(path, f, getconverter(style))
                    except:
                        f.close()
                        raise
                    f.close()
                if singleHTML or frameHTML:
                    terms = aeteparser.parseaetes(aetes, path, style)
                    if singleHTML:
                        outputPath = _makeDestinationFolder(
                            outFolder, styleSubfolderName, exportToSubfolders and "html", name + suffix + ".html"
                        )
                        progress.nextoutput(u"%s" % outputPath)
                        html = htmldoc.renderdictionary(terms, style, options)
                        f = open(outputPath, "w")
                        f.write(str(html))
                        f.close()
                    if frameHTML:
                        outputPath = _makeDestinationFolder(
                            outFolder, styleSubfolderName, exportToSubfolders and "frame-html", name + suffix
                        )
                        progress.nextoutput(u"%s" % outputPath)
                        htmldoc2.renderdictionary(terms, outputPath, style, options)
        except Exception, err:
            from traceback import print_exc
            from StringIO import StringIO

            out = StringIO()
            print_exc(file=out)
            progress.didfail(u"Unexpected error:/n%s" % out.getvalue())
Esempio n. 10
0
def export(items,
           styles,
           plainText,
           singleHTML,
           frameHTML,
           objcGlue,
           options,
           outFolder,
           exportToSubfolders,
           progress,
           info={}):
    styleInfo = [(style, kStyleToSuffix[style]) for style in styles]
    # process each item
    for i, item in enumerate(items):
        sdef = aetes = None
        objcPrefix, name, path = item['objcPrefix'], item['name'], item['path']
        if path == NSBundle.mainBundle().bundlePath():
            continue
        progress.nextitem(name, path)
        try:
            isOSAX = path.lower().endswith('.osax')
            if isOSAX:
                try:
                    sdef = ae.copyscriptingdefinition(path)
                except ae.MacOSError, e:
                    if e.args[0] == -10827:
                        progress.didfail(u"No terminology found.")
                        continue
                    else:
                        raise
            else:
                Application
                aetes = aetesforapp(Application(path))
            if not bool(sdef or aetes):
                progress.didfail(u"No terminology found.")
                continue
            for style, suffix in styleInfo:
                styleSubfolderName = exportToSubfolders and style or ''
                if not progress.shouldcontinue():
                    for item in items[i:]:
                        progress.didfail(u"User cancelled.")
                        progress.nextapp(item['name'], item['path'])
                    progress.didfail(u"User cancelled.")
                    progress.didfinish()
                    return
                if plainText and not isOSAX:
                    outputPath = _makeDestinationFolder(
                        outFolder, styleSubfolderName, exportToSubfolders
                        and 'text', name + suffix + '.txt')
                    progress.nextoutput(u'%s' % outputPath)
                    f = file(outputPath, 'w')
                    try:
                        f.write('\xEF\xBB\xBF')  # UTF8 BOM
                        quickdoc.renderaetes(
                            aetes, f, makeidentifier.getconverter(style))
                    except:
                        f.close()
                        raise
                    f.close()
                if singleHTML or frameHTML:
                    if isOSAX:
                        terms = sdefparser.parsexml(sdef, path, style)
                    else:
                        terms = aeteparser.parseaetes(aetes, path, style)
                    if singleHTML:
                        outputPath = _makeDestinationFolder(
                            outFolder, styleSubfolderName, exportToSubfolders
                            and 'html', name + suffix + '.html')
                        progress.nextoutput(u'%s' % outputPath)
                        html = htmldoc.renderdictionary(terms, style, options)
                        f = open(outputPath, 'w')
                        f.write(str(html))
                        f.close()
                    if frameHTML:
                        outputPath = _makeDestinationFolder(
                            outFolder, styleSubfolderName, exportToSubfolders
                            and 'frame-html', name + suffix)
                        progress.nextoutput(u'%s' % outputPath)
                        htmldoc2.renderdictionary(terms, outputPath, style,
                                                  options, info)
            if objcGlue and not isOSAX:
                outputPath = _makeDestinationFolder(
                    outFolder, exportToSubfolders and 'objc-appscript' or '',
                    '%s%sGlue' %
                    (exportToSubfolders and 'glues/' or '', objcPrefix), '')
                objcappscript.makeappglue(path, objcPrefix, outputPath, aetes)
                progress.nextoutput(u'%s' % outputPath)
Esempio n. 11
0
class ObjCAppscriptParser(AppscriptHandler):
	asname = staticmethod(makeidentifier.getconverter('objc-appscript'))
	appscripttypemodule = appscripttypes.typetables('objc-appscript')
Esempio n. 12
0
class RbAppscriptHandler(AppscriptHandler):
	asname = staticmethod(makeidentifier.getconverter('rb-appscript'))
	appscripttypemodule = appscripttypes.typetables('rb-appscript')
Esempio n. 13
0
######################################################################
# SHELL
######################################################################

if __name__ == '__main__':
    from getopt import getopt
    if len(sys.argv) < 2:
        print _help
    else:
        opts, args = getopt(sys.argv[1:], 'ck')
        target = args[0]
        if args[1:]:
            out = open(args[1].encode('utf8'), 'w')
            out.write('\xEF\xBB\xBFTerminology for %s\n' %
                      (('-c', '') in opts and 'component %r' % _code(target)
                       or target.encode('utf8')))
        else:
            out = None
        if ('-k', '') in opts:
            converter = getconverter('appscript')
        else:
            converter = None
        if ('-c', '') in opts:
            component(target, out or sys.stdout, converter)
        else:
            app(expanduser(target.encode('utf8')), out or sys.stdout,
                converter)
        if out:
            out.close()
Esempio n. 14
0
#!/usr/bin/python

import types, datetime, os.path, re

import aem, appscript
from appscript import mactypes
from osaterminology import makeidentifier

from osaterminology.tables.tablebuilder import *

#######

_formatterCache = {}
_self = aem.Application()
_codecs = aem.Codecs()
_convert = makeidentifier.getconverter('objc-appscript')
_terminology = TerminologyTableBuilder('objc-appscript')

######################################################################
# PRIVATE
######################################################################


class _Formatter:
    def __init__(self, typebycode, referencebycode, appvar, prefix, indent=''):
        self._referencebycode = referencebycode
        self._typebycode = typebycode
        self._prefix = prefix
        self._indent = indent
        self._valueFormatters = {
            types.NoneType: self.formatNone,
Esempio n. 15
0
class RbAppscriptParser(_AppscriptParser):
    _asname = staticmethod(makeidentifier.getconverter('rb-appscript'))
    typemodule = appscripttypes.typetables('rb-appscript')
Esempio n. 16
0
class ObjCAppscriptParser(AppscriptParser):
    asname = staticmethod(makeidentifier.getconverter('objc-appscript'))

    def typemodule(self):
        return objcappscripttypes
Esempio n. 17
0
def _export(items, styles, plainText, singleHTML, frameHTML, objcGlue, options,
            outFolder, exportToSubfolders, progress):
    styleInfo = [(style, kStyleToSuffix[style]) for style in styles]
    # process each item
    for i, item in enumerate(items):
        objcPrefix, name, path, isOSAX = item['objcPrefix'], item[
            'name'], item['path'], item['isOSAX']
        progress.nextitem(name, path)
        try:
            try:
                aetes = GetAppTerminology(path)
            except MacOSError, e:
                if e.args[0] != -192:
                    raise
                aetes = []
            if not bool(aetes):
                progress.didfail(u"No terminology found.")
                continue
            for style, suffix in styleInfo:
                styleSubfolderName = exportToSubfolders and style or ''
                if not progress.shouldcontinue():
                    for item in items[i:]:
                        progress.didfail(u"User cancelled.")
                        progress.nextapp(item['name'], item['path'])
                    progress.didfail(u"User cancelled.")
                    progress.didfinish()
                    return
                if plainText:
                    outputPath = _makeDestinationFolder(
                        outFolder, styleSubfolderName, exportToSubfolders
                        and 'text', name + suffix + '.txt')
                    progress.nextoutput(u'%s' % outputPath)
                    f = file(outputPath, 'w')
                    try:
                        f.write('\xEF\xBB\xBF')  # UTF8 BOM
                        quickdoc.app(path, f, getconverter(style))
                    except:
                        f.close()
                        raise
                    f.close()
                if singleHTML or frameHTML:
                    terms = aeteparser.parseaetes(aetes, path, style)
                    if singleHTML:
                        outputPath = _makeDestinationFolder(
                            outFolder, styleSubfolderName, exportToSubfolders
                            and 'html', name + suffix + '.html')
                        progress.nextoutput(u'%s' % outputPath)
                        html = htmldoc.renderdictionary(terms, style, options)
                        f = open(outputPath, 'w')
                        f.write(str(html))
                        f.close()
                    if frameHTML:
                        outputPath = _makeDestinationFolder(
                            outFolder, styleSubfolderName, exportToSubfolders
                            and 'frame-html', name + suffix)
                        progress.nextoutput(u'%s' % outputPath)
                        htmldoc2.renderdictionary(terms, outputPath, style,
                                                  options)
            if objcGlue:
                outputPath = _makeDestinationFolder(
                    outFolder, 'objc-appscript', '%s%sGlue' %
                    (exportToSubfolders and 'glues/' or '', objcPrefix), '')
                renderer = osaglue.GlueRenderer(outputPath, objcPrefix)
                if isOSAX:
                    renderer.renderosaxaetes(path, aetes)
                else:
                    renderer.renderappaetes(path, aetes)
                progress.nextoutput(u'%s' % outputPath)
        except Exception, err:
            from traceback import print_exc
            from StringIO import StringIO
            out = StringIO()
            print_exc(file=out)
            progress.didfail(u'Unexpected error:/n%s' % out.getvalue())
Esempio n. 18
0
import types, datetime, os.path, re

import aem, appscript
from appscript import mactypes
from osaterminology import makeidentifier
from osaterminology.tables.tablebuilder import *
from osaterminology.makeglue.objcappscript import nametoprefix

from constants import *

#######

_formatterCache = {}
_self = aem.Application()
_codecs = aem.Codecs()
_convert = makeidentifier.getconverter('objc-appscript')
_terminology = TerminologyTableBuilder('objc-appscript')

######################################################################
# PRIVATE
######################################################################


class _Formatter:
	def __init__(self, typebycode, referencebycode, appvar, prefix, indent=''):
		self._referencebycode = referencebycode
		self._typebycode = typebycode
		self._prefix = prefix
		self._indent = indent
		self._valueFormatters = {
				types.NoneType: self.formatNone,
Esempio n. 19
0
class RbAppscriptParser(AppscriptParser):
    asname = staticmethod(makeidentifier.getconverter('rb-appscript'))
Esempio n. 20
0
def export(items, styles, plainText, singleHTML, frameHTML, objcGlue, options, outFolder, exportToSubfolders, progress, info={}):
	styleInfo = [(style, kStyleToSuffix[style]) for style in styles]
	# process each item
	for i, item in enumerate(items):
		sdef = aetes = None
		objcPrefix, name, path = item['objcPrefix'], item['name'], item['path']
		if path == NSBundle.mainBundle().bundlePath():
			continue
		progress.nextitem(name, path)
		try:
			isOSAX = path.lower().endswith('.osax')
			if isOSAX:
				try:
					sdef = ae.copyscriptingdefinition(path)
				except ae.MacOSError, e:
					if e.args[0] == -10827:
						progress.didfail(u"No terminology found.")
						continue
					else:
						raise
			else:
				Application
				aetes = aetesforapp(Application(path))
			if not bool(sdef or aetes):
				progress.didfail(u"No terminology found.")
				continue
			for style, suffix in styleInfo:
				styleSubfolderName = exportToSubfolders and style or ''
				if not progress.shouldcontinue():
					for item in items[i:]:
						progress.didfail(u"User cancelled.")
						progress.nextapp(item['name'], item['path'])
					progress.didfail(u"User cancelled.")
					progress.didfinish()
					return
				if plainText and not isOSAX:
					outputPath = _makeDestinationFolder(outFolder, styleSubfolderName, 
							exportToSubfolders and 'text', name + suffix + '.txt')
					progress.nextoutput(u'%s' % outputPath)
					f = file(outputPath, 'w')
					try:
						f.write('\xEF\xBB\xBF') # UTF8 BOM
						quickdoc.renderaetes(aetes, f, makeidentifier.getconverter(style))
					except:
						f.close()
						raise
					f.close()
				if singleHTML or frameHTML:
					if isOSAX:
						terms = sdefparser.parsexml(sdef, path, style)
					else:
						terms = aeteparser.parseaetes(aetes, path, style)
					if singleHTML:
						outputPath = _makeDestinationFolder(outFolder, styleSubfolderName, 
								exportToSubfolders and 'html', name + suffix + '.html')
						progress.nextoutput(u'%s' % outputPath)
						html = htmldoc.renderdictionary(terms, style, options)
						f = open(outputPath, 'w')
						f.write(str(html))
						f.close()
					if frameHTML:
						outputPath = _makeDestinationFolder(outFolder, styleSubfolderName, 
								exportToSubfolders and 'frame-html', name + suffix)
						progress.nextoutput(u'%s' % outputPath)
						htmldoc2.renderdictionary(terms, outputPath, style, options, info)
			if objcGlue and not isOSAX:
				outputPath = _makeDestinationFolder(outFolder, 
						exportToSubfolders and 'objc-appscript' or '', 
						'%s%sGlue' % (exportToSubfolders and 'glues/' or '', objcPrefix), '')
				objcappscript.makeappglue(path, objcPrefix, outputPath, aetes)
				progress.nextoutput(u'%s' % outputPath)
Esempio n. 21
0
class PyAppscriptHandler(AppscriptHandler):
    asname = staticmethod(makeidentifier.getconverter('py-appscript'))
Esempio n. 22
0
def _export(items, styles, plainText, singleHTML, frameHTML, objcGlue, options, outFolder, exportToSubfolders, progress):
	styleInfo = [(style, kStyleToSuffix[style]) for style in styles]
	# process each item
	for i, item in enumerate(items):
		objcPrefix, name, path, isOSAX = item['objcPrefix'], item['name'], item['path'], item['isOSAX']
		progress.nextitem(name, path)
		try:
			try:
				aetes = GetAppTerminology(path)
			except MacOSError, e:
				if e.args[0] != -192:
					raise
				aetes = []
			if not bool(aetes):
				progress.didfail(u"No terminology found.")
				continue
			for style, suffix in styleInfo:
				styleSubfolderName = exportToSubfolders and style or ''
				if not progress.shouldcontinue():
					for item in items[i:]:
						progress.didfail(u"User cancelled.")
						progress.nextapp(item['name'], item['path'])
					progress.didfail(u"User cancelled.")
					progress.didfinish()
					return
				if plainText:
					outputPath = _makeDestinationFolder(outFolder, styleSubfolderName, 
							exportToSubfolders and 'text', name + suffix + '.txt')
					progress.nextoutput(u'%s' % outputPath)
					f = file(outputPath, 'w')
					try:
						f.write('\xEF\xBB\xBF') # UTF8 BOM
						quickdoc.app(path, f, getconverter(style))
					except:
						f.close()
						raise
					f.close()
				if singleHTML or frameHTML:
					terms = aeteparser.parseaetes(aetes, path, style)
					if singleHTML:
						outputPath = _makeDestinationFolder(outFolder, styleSubfolderName, 
								exportToSubfolders and 'html', name + suffix + '.html')
						progress.nextoutput(u'%s' % outputPath)
						html = htmldoc.renderdictionary(terms, style, options)
						f = open(outputPath, 'w')
						f.write(str(html))
						f.close()
					if frameHTML:
						outputPath = _makeDestinationFolder(outFolder, styleSubfolderName, 
								exportToSubfolders and 'frame-html', name + suffix)
						progress.nextoutput(u'%s' % outputPath)
						htmldoc2.renderdictionary(terms, outputPath, style, options)
			if objcGlue:
				outputPath = _makeDestinationFolder(outFolder, 'objc-appscript', 
							'%s%sGlue' % (exportToSubfolders and 'glues/' or '', objcPrefix), '')
				renderer = osaglue.GlueRenderer(outputPath, objcPrefix)
				if isOSAX:
					renderer.renderosaxaetes(path, aetes)
				else:
					renderer.renderappaetes(path, aetes)
				progress.nextoutput(u'%s' % outputPath)
		except Exception, err:
			from traceback import print_exc
			from StringIO import StringIO
			out = StringIO()
			print_exc(file=out)
			progress.didfail(u'Unexpected error:/n%s' % out.getvalue())