Print Page | Close Window

Getting command macro to repeat

Printed From: MSSpeech-Forum
Category: Windows™ Speech Recognition Forums
Forum Name: Macros and Macro Development
Forum Description: WSR Macros, Tools, Files, and new Macro requests
URL: https://www.msspeech-forum.com/forum_posts.asp?TID=109
Printed Date: 22/Dec/2024 at 12:01pm
Software Version: Web Wiz Forums 12.02 - http://www.webwizforums.com


Topic: Getting command macro to repeat
Posted By: dtee
Subject: Getting command macro to repeat
Date Posted: 11/Jul/2009 at 7:17pm
I bought WSRMacros: The User's Guide several days ago. It gets top marks from me as it has already helped me consolidate my hodgepodge of speech macros. Thank you for all the good work, Brad!

There is one thing I was hoping to find in the guide but did not, maybe because I don't know enough about programming to spot it. Is there a simple way to get a command macro to repeat X-number of times? Here is the simplest macro of this kind. I use it many times a week in Word 2007 outline mode:

<!--This macro presses the tab key to change the current line to body-text level, moves the cursor down a line and to the end of the line in case there are more lines than one line requiring changing to body text-->
<command>
    <listenFor>Body fast</listenFor>
    <sendKeys>{TAB}{DOWN}{END}</sendKeys>
  </command>

Since I can see whether I need this to happen more than once, it would be nice to say, for example, Body fast 2 or 3 or whatever to get the whole job done with one utterance. Do I need to use CDATA and some visual basic code, or is there a still simpler way?

Thanks and regards,
Daniel




Replies:
Posted By: mmarkoe
Date Posted: 12/Jul/2009 at 10:26am
Originally posted by dtee dtee wrote:

Is there a simple way to get a command macro to repeat X-number of times?
Brad is pretty much totally involved in a new project so I wrote him privately with your request. He responded with:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

The SendKeys allows repeating with the times keyword:

 <sendKeys times="3">{UP}</sendKeys>

 
Or maybe something like this:

<emulateRecognition>Name of command macro to run</emulateRecognition>

<emulateRecognition>Name of command macro to run</emulateRecognition>

<emulateRecognition>Name of command macro to run</emulateRecognition>

 

You may be able to fancy it up with a rule that listens for numbers too...

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hope this helps.
Marty


-------------
Marty Markoe, MVP
Microsoft Valued Partner
See us at: http://www.mymsspeech.com


Posted By: dtee
Date Posted: 12/Jul/2009 at 5:44pm
Hi Marty,

Thanks for passing this on. I'll try "times" tomorrow at work, see if it does the trick and report on the results here.

Daniel


Posted By: dtee
Date Posted: 14/Jul/2009 at 6:42pm
Well Marty,

It took me a bit longer to report back than I thought it would, but hopefully the wait was worth it Wink. Adding the times = "[some number]" element to the sendKeys tag does the trick. Here it is:

<speechMacros>

<!--This speech macro, when used in Word's Outline View, will demote the current paragraph one level, and will repeat up to 6 times for successive paragraphs. I find this macro extremely useful in setting up newsletters since I use Outline View for quick formatting. The spoken variable [Reps], the <sendKeys times="{[Reps]}">  tag and the numbers-name tag are the key elements for getting the macro to repeat.

What can be a spoken: "Body fast one", "Body fast two", etc., up to "Body fast six".

This approach could be used to repeat any combination of keys inside the sendKeys tags.-->

  <command>
    <listenFor>Body fast [Reps]</listenFor>
    <sendKeys times="{[Reps]}">{TAB}{DOWN}{END}</sendKeys>
  </command>
  <numbers name="Reps" start="1" stop="6"/>
</speechMacros>

Best regards and thanks to you and Brad,
Daniel




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.02 - http://www.webwizforums.com
Copyright ©2001-2019 Web Wiz Ltd. - https://www.webwiz.net