Actions
Numbers and Spoken Forms
Unimacro and Vocola
Tracing
Inifiles
Translations
Cooperation with voicecoder
AutoHotkey
Unit testing
Grammar classes
 grammarX
 Browsable Grammar
 IniGrammar
 DocstringGrammar
  Fullresults
  Example tasks grammar
  Example word styles
  Programmer
 Natlinkutilsbj
 Natlinkutilsqh
Global dictation
Monitorfunctions

example winword_styles_unimacro

This little grammar is rewritten into Docstring grammar style.

Instead of

    gramSpec = ”””
        <showStyles> exported = show styles;
        <updateStyles> exported = update styles;
        <setStyle> exported = set style {style};
    ”””

The rules now appear as:

    def rule_updateStyles(self, words):
        “update styles”
        # possibility to “manually” update the styles list
        # not needed in normal use
        self.updateStyles()

    def rule_showStyles(self, words):
        “show styles”
        # print a list of all valid styles in the messages window
        if self.styles:
            print ‘styles in use: %s’% self.styles.keys()
        else:
            print ‘no styles in use...’

    def rule_setStyle(self, words):
        “set style {style}”
        #apply a style to the cursor or selection
        style = words[-1]
        if style in self.styles:
            print ‘setting style %s’% style
            sel = self.application.Selection
            sel.Style = style
        else:
            print ‘style not in stylelist: %s’% style

  • Again, with the commands show word styles (Dutch: "toon weurd opmaakprofielen"), or with the command show all grammars (Dutch: "toon alle grammatica's") you can inspect the contents of the grammar.
  • This grammar is located in the DisabledGrammars folder if you installed from the combined NatLink/Unimacro/Vocola installer.