KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: How to write a single command that will repeat / loop an action X times?
Topic Summary:
Created On: 02/06/2021 01:54 PM
Status: Post and Reply
Linear : Threading : Single : Branch
Keyword
 02/06/2021 01:54 PM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Senior Member

Posts: 137
Joined: 09/03/2020

I want a command like "undo <1to100>" that will do a command over and over based on the number dictated.

 

I know how to do this for a single key stroke, like the Knowbrainer command "page up 5":

 

SendKeys "{PgUp "+ListVar1+"}"

But how do we achieve the same behavior when it is not a single command key, but instead for a hotkey like "^z" ?

 

I actually thought there was a command for undoing something multiple times in Knowbrainer, but I don't see it in my Knowbrainer command list anymore.

 



-------------------------

Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017.

 02/06/2021 02:27 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 3724
Joined: 01/14/2008

using your command name "Undo <1_100>"

Sub Main
    finish = ListVar1
    For number = 1 To finish
       SendKeys "^z"
    Next number
End Sub

 



-------------------------



 02/08/2021 11:38 AM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Senior Member

Posts: 137
Joined: 09/03/2020

Beautiful, thank you. In addition to "undo X", I am also using this to "close X tabs" in browsers.

-------------------------

Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017.

Statistics
31980 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 0 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 599 guests browsing this forum, which makes a total of 599 users using this forum.

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