![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Script to convert numbers into their written form Topic Summary: Created On: 11/10/2021 05:14 PM Status: Post and Reply |
|
![]() |
![]() |
- Alan Cantor | - 11/10/2021 05:14 PM |
![]() |
![]() |
- PG LTU | - 11/11/2021 10:50 AM |
![]() |
![]() |
- Alan Cantor | - 11/11/2021 01:08 PM |
![]() |
![]() |
- kkkwj | - 11/13/2021 01:44 AM |
![]() |
![]() |
- Alan Cantor | - 11/14/2021 11:13 AM |
![]() |
|
I'm working with somebody who needs to express dollar amounts both as numbers, and as the words spelled out. For example:
$123,456 (one hundred and twenty three thousand four hundred fifty six dollars)
I've written a script that works by retrieving the spelled out version from the Recognition History. So to make it work, you say the dollar amount, pause, and then invoke the following command. The command calls up the Recognition History, navigates to the list of utterances, copies the value to the clipboard, closes the recognition history dialog, does some string manipulation, and then outputs the spelled out version.
Sub Main Dim engine As New DgnEngineControl, n As Long engine.DlgShow(dgndlgRecognitionHistory, n,, 0) Wait 0.5 SendSystemKeys "{Up}" SendSystemKeys "{Alt+u}" SendSystemKeys "{Ctrl+c}" SendSystemKeys "{Esc}" Let x = Clipboard Let x = " (" & x & ")" Wait 1.3 SendDragonKeys x End Sub Does anybody know of a way to directly retrieve the value of the last utterance without invoking the Recognition History dialog box, navigating from field to field, using the clipboard, and so on? |
|
|
|
![]() |
|
This keeps coming up . . . -------------------------
|
|
|
|
![]() |
|
Thanks for unearthing that ancient thread, Philip. Indeed, interest in the question is longstanding, and so far, there does not appear to be a bulletproof solution. |
|
|
|
![]() |
|
This may or may not help, but there are MUCH longer and more complex scripts that convert numbers to words and words to numbers on the net. I don't recall ever seeing one in Basic, though. And it's probably much more work than it's worth to get it running and debugged when you have scripts like the ones above that work most of the time. Just a thought.
I take it back about never having seen a big script in Basic - PG just posted a link to his version from long ago! ------------------------- Win10/11/x64, AMD Ryzen 7 3700X/3950X, 64/128GB RAM, Dragon 15.3, SP 7 Standard, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Amazon YUWAKAYI headset, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse |
|
|
|
![]() |
|
And it's probably much more work than it's worth to get it running and debugged when you have scripts like the ones above that work most of the time. Just a thought. A very good thought! Although none of the scripts are perfect, they usually work well enough. On the other hand, I can see myself putting in the time, as Philip has done, to craft a home-brew digit-to-word translator. A fun project for a rainy day. Here is the latest version of my script, which runs a little faster and is less "flashy." Sub Main ' "Convert <dictation>" ' This script takes a price as input, e.g., "$450", and outputs it thus: ' $450 (four hundred and fifty dollars) Dim engine As New DgnEngineControl, n As Long engine.DlgShow(dgndlgRecognitionHistory, n,, 0) ' Invoke "Recognition History" dialog Wait 0.25 ' Wait for "Recognition History" to gain focus SendSystemKeys "{Alt+u}{Ctrl+c}{Esc}" ' Copy utterance, close window Wait 0.5 ' Clipboard operations are slow in Win 10! Clipboard " " & ListVar1 & " (" & Replace(Clipboard, "Convert ", "") & ")" SendSystemKeys "{Ctrl+v}" End Sub |
|
|
FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.