![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Help with using SendKeys for longish text Topic Summary: Created On: 10/07/2021 11:21 AM Status: Post and Reply |
|
![]() |
![]() |
- bobe | - 10/07/2021 11:21 AM |
![]() |
![]() |
- R. Wilke | - 10/07/2021 11:28 AM |
![]() |
![]() |
- Edgar | - 10/07/2021 11:39 AM |
![]() |
![]() |
- dilligence | - 10/07/2021 01:30 PM |
![]() |
![]() |
- bobe | - 10/07/2021 05:02 PM |
![]() |
|||||
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 ===
|
|||||
|
|||||
![]() |
|||||
Although probably doable, I would definitely not recommend starting to mess around with SendKeys, but maybe this is a good time to look at: -------------------------
|
|||||
|
|||||
![]() |
|||||
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 |
|||||
|
|||||
![]() |
|||||
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.
------------------------- Turbocharge your Dragon® productivity with 40 Power Addons |
|||||
|
|||||
![]() |
|||||
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. |
|||||
|
FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.