KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Help with using SendKeys for longish text
Topic Summary:
Created On: 10/07/2021 11:21 AM
Status: Post and Reply
Linear : Threading : Single : Branch
Keyword
 10/07/2021 11:21 AM
User is offline View Users Profile Print this message

Author Icon
bobe
New Member

Posts: 18
Joined: 07/09/2013

Hi All,

I need to use SendKeys (or something that doesn't use copy/paste/clipboard) to send longish text (100 words or less) into an application (OpenOffice). 

Short backstory: the DNS commands I've written to use in OpenOffice do so via the clipboard and its' broken.

https://www.knowbrainer.com/forums/forum/messageview.cfm?catid=4&threadid=36032 

Any suggestions ? My knowledge of verbal basic is limit to the suspicion that it's going to require some kind of loop structure to break the text into short segments and then pass on to Sendkeys.

If it's going to require some work I am happy to compensate you to reduce the amount of hari pulling that I'd need to do to learn to do it myself.

Thanks 

Bob

Concrete example would be to send the following via command "example text"

===

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

===

 

 

 



 10/07/2021 11:28 AM
User is offline View Users Profile Print this message

Author Icon
R. Wilke
Top-Tier Member

Posts: 7881
Joined: 03/04/2007

Although probably doable, I would definitely not recommend starting to mess around with SendKeys, but maybe this is a good time to look at:

DragonCapture – DragonUtilities (rwilke.de)

And if you do, I would strongly suggest starting by watching the videos listed on the page.

Not sure how it turns out working if by "command" you are referring to boilerplate text, but you can always give it a shot for free, with no strings or hassle attached.



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



No need to buy if all you want to do is try ...

DragonCapture KB Download (Latest)
DragonCapture Homepage



 10/07/2021 11:39 AM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1276
Joined: 04/03/2009

This should* work:

 

Sub Main

Dim words() As String' dimension a string array

Dim dictation As String

Dim k As Integer

 

dictation = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"

words = Split(dictation, " ")

For k = 0 To UBound(words)

      SendKeys words(k) & " ", 1

Next

End Sub

 

*Might fail if dictation includes any of: carriage return, line feed, new line, new paragraph; I have not tested this code



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

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 10/07/2021 01:30 PM
User is offline View Users Profile Print this message

Author Icon
dilligence
Top-Tier Member

Posts: 1542
Joined: 08/16/2010

It may be just me, but it really needn't be that complicated and it's certainly not necessary to install any kind of "utility" for this.

Why not use a simple boilerplate? It doesn't occupy the clipboard and it works very well in Open Office:

 

 

 

 

I've also attached the command so you can simply import it into your Dragon® Command Browser.

 

About Open Office. Apart from the fact that it is not DPI-Aware, I don't see anything "broken" with it....

Maybe you should download the previous 4.1.6 version which is also speech friendly. Click the image to download:

 

 

 

 

 

BTW, it's very well possible to use SendKeys for this, albeit it'll perform kinda slow. However, if you use DVC Scripting for this instead of Advanced Scripting. The speed will be acceptable. I have attached that version as well.

 

Here is an Easy To Understand Guide to get you going with DVC scripting and creating productive Dragon® voice commands in general.






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

https://speechproductivity.eu


Turbocharge your Dragon® productivity with 40 Power Addons



 10/07/2021 05:02 PM
User is offline View Users Profile Print this message

Author Icon
bobe
New Member

Posts: 18
Joined: 07/09/2013

Thanks Edgar.
Your script worked fine although I'd need to do some sleuthing on how to transmit a newline.

And @diligence's DVC script also worked. I had tried using a longer phrase in a KB command, and got a "too long" type error, but running it as a DVC script works just fine. I guess the old technology is better for some things.

And in case I wasn't clear, I've been using Auto-text commands in DNS and OpenOffice for decades. The text is copied to the clipboard and then pasted into the application (if you use a clipboard manager, you can watch it happen). That copy/paste paradigm stopped working some months ago, about the time MS win10 made the clipboard shareable across devices. I hope you never run into the problem, but I'm often working on a document for hours at a time, and after a bit of time copy paste starts misbehaving and incorrect material is pasted into OO. [I even replaced my PC, but had the same problem]

I consider the problem solved. Thanks for the help.
Statistics
32324 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 410 guests browsing this forum, which makes a total of 410 users using this forum.

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