KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Vocola Procedure for Microsoft Word?
Topic Summary: Need help in drafting a Vocola procedure for Microsoft Word
Created On: 01/22/2022 12:59 PM
Status: Post and Reply
Linear : Threading : Single : Branch
Keyword
 01/22/2022 12:59 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 569
Joined: 08/09/2018

If you've created a successful Vocola Procedure for controlling Microsoft Word, I'd love to see it. I've been trying to write one for couple of days now, but it keeps giving me an error message to the effect of:

vocola_ext_Word.py:12: Error: Vocola extension specification line not followed by a def name(... line

I've been using the official Vocola extension for Microsoft Excel as a model, but can figure out the right wording for Microsoft Word. My goal is to have a procedure that will run any Microsoft Word macro that I have created.

 01/22/2022 08:58 PM
User is offline View Users Profile Print this message


mdl
Top-Tier Member

Posts: 906
Joined: 04/18/2009

can you please post the text around line 12?
 01/23/2022 07:50 AM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 569
Joined: 08/09/2018

Yes, of course:

12 # Vocola procedure: Word.RunMacro
13 def run_macro(mConvertFootnotes):
14 xlApp = open_Word()
15 xlApp.Application.Run(mConvertFootnotes)

No more code after line 15.
 01/23/2022 01:26 PM
User is offline View Users Profile Print this message


mdl
Top-Tier Member

Posts: 906
Joined: 04/18/2009

weird, I  created a extension with just:

# Vocola procedure: Word.RunMacro

def run_macro(mConvertFootnotes):

    xlApp = open_Word()

    xlApp.Application.Run(mConvertFootnotes)

 

and it worked fine for me.

 01/23/2022 01:27 PM
User is offline View Users Profile Print this message


mdl
Top-Tier Member

Posts: 906
Joined: 04/18/2009

the relevant matching code is:

    m = re.search(r'^\s*def\s+([^(]+)\(([^)]*)', second_line)

    if m == None:

        error(("%s.py:%d: Error: Vocola extension specification line " +

               "not followed by a def name(... line") %

              (extension, line_number))

 I'm not seeing any reason why that would not match
 01/23/2022 01:34 PM
User is offline View Users Profile Print this message


mdl
Top-Tier Member

Posts: 906
Joined: 04/18/2009

one idea: are you using the Windows line ending convention? (\r\n)

I tried switching to just \n's and that still worked
maybe just \r's breaks?
 01/23/2022 05:08 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 569
Joined: 08/09/2018

Thanks for the suggestions. I will play around with it tomorrow and see if I can figure out the issue.
 01/30/2022 12:49 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 569
Joined: 08/09/2018

I seem to have gotten past the initial issue, by simply deleting the extension and starting over. Don't ask me to explain that.

Am having some issues with the VBA code, but I'll figure it out eventually.
Statistics
32306 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 1 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 449 guests browsing this forum, which makes a total of 450 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.