MSSpeech-Forum Homepage
Forum Home Forum Home > Windows™ Speech Recognition Forums > Macros and Macro Development
  New Posts New Posts RSS Feed - Getting command macro to repeat
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Getting command macro to repeat

 Post Reply Post Reply
Author
Message
dtee View Drop Down
Member
Member


Joined: 14/Nov/2008
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote dtee Quote  Post ReplyReply Direct Link To This Post Topic: Getting command macro to repeat
    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

Back to Top
mmarkoe View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 24/Jul/2008
Status: Offline
Points: 210
Post Options Post Options   Thanks (0) Thanks(0)   Quote mmarkoe Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
dtee View Drop Down
Member
Member


Joined: 14/Nov/2008
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote dtee Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
dtee View Drop Down
Member
Member


Joined: 14/Nov/2008
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote dtee Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.02
Copyright ©2001-2019 Web Wiz Ltd.

This page was generated in 0.312 seconds.

Microsoft Most Valuable Professional

§- Thank you for visiting our Windows Speech Recognition and Macro Forum.. -§