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
 Vocola Procedure for Microsoft Word?   - Matt_Chambers - 01/22/2022 12:59 PM  
 Vocola Procedure for Microsoft Word?   - mdl - 01/22/2022 08:58 PM  
 Vocola Procedure for Microsoft Word?   - Matt_Chambers - 01/23/2022 07:50 AM  
 Vocola Procedure for Microsoft Word?   - mdl - 01/23/2022 01:26 PM  
 Vocola Procedure for Microsoft Word?   - mdl - 01/23/2022 01:27 PM  
 Vocola Procedure for Microsoft Word?   - mdl - 01/23/2022 01:34 PM  
 Vocola Procedure for Microsoft Word?   - Matt_Chambers - 01/23/2022 05:08 PM  
 Vocola Procedure for Microsoft Word?   - Matt_Chambers - 01/30/2022 12:49 PM  
 Vocola Procedure for Microsoft Word?   - mdl - 09/02/2022 04:28 PM  
 Vocola Procedure for Microsoft Word?   - Matt_Chambers - 09/03/2022 03:36 PM  
Keyword
 01/22/2022 12:59 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 756
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: 938
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: 756
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: 938
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: 938
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: 938
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: 756
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: 756
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.
 09/02/2022 04:28 PM
User is offline View Users Profile Print this message


mdl
Top-Tier Member

Posts: 938
Joined: 04/18/2009

FYI, I have had luck creating VBA macros in word and binding them to keyboard shortcuts and then calling them from Vocola.
 09/03/2022 03:36 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 756
Joined: 08/09/2018

Originally posted by: mdl FYI, I have had luck creating VBA macros in word and binding them to keyboard shortcuts and then calling them from Vocola.

Thanks, but I don't want to do have to assign keyboard shortcuts to the macros.  I'll just stick with Advanced Scripting.

Statistics
32528 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 364 guests browsing this forum, which makes a total of 365 users using this forum.

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