KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: How to convert clipboard text to uppercase?
Topic Summary:
Created On: 09/10/2020 12:31 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 How to convert clipboard text to uppercase?   - wristofdoom - 09/10/2020 12:31 PM  
 How to convert clipboard text to uppercase?   - Edgar - 09/10/2020 01:40 PM  
 How to convert clipboard text to uppercase?   - Edgar - 09/10/2020 01:43 PM  
 How to convert clipboard text to uppercase?   - wristofdoom - 09/10/2020 01:53 PM  
Keyword
 09/10/2020 12:31 PM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Power Member

Posts: 58
Joined: 09/03/2020

Hi,

 

I am writing a script in Knowbrainer called "new character <dictation>"

 

The desired behavior is to send 2 linebreaks (hit the enter key twice), then type the @ symbol followed by whatever I said in the <dictation> variable, and then hit enter once.

 

(This is useful for writing in Fountain, which is a screenplay writing syntax where a character in a screenplay is indicated by an @ followed by the characters name.)

 

Here's what it looks like so far, and it's working:

 

Sub Main
SendKeys "~"
Wait .1
SendKeys "~"
Wait .1
origClip=Clipboard
Wait .1
Clipboard ListVar1
Wait .1
SendKeys "@"
Wait .1
SendKeys "^v"
Wait .5
SendKeys "~"
Wait .3
End Sub


my question: how do I convert the value stored in <dictation> to uppercase?

 

For example, if I say out loud, "new character Logan", then currently the output is:

 

@Logan

 

The output that I want is:

 

@LOGAN

 

Also, this is my first Knowbrainer script. Are there any best practices I am violating? For example, if I want to hit the "enter" key twice, does that need to be on separate lines, or can I put it all on one line?

 

Finally, this is a side question that I haven't looked up yet, but how can I save this command in a way that it will not be overwritten by the next Knowbrainer update?

 

Thank you



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

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

 09/10/2020 01:40 PM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 915
Joined: 04/03/2009

Originally posted by: wristofdoom 

my question: how do I convert the value stored in  to uppercase?

 

 

 

Also, this is my first Knowbrainer script. Are there any best practices I am violating? For example, if I want to hit the "enter" key twice, does that need to be on separate lines, or can I put it all on one line?

 

 

 

Finally, this is a side question that I haven't looked up yet, but how can I save this command in a way that it will not be overwritten by the next Knowbrainer update?

I'll take these in reverse order…

At the present time you will need to create this as a Dragon command to avoid being overwritten by the next KnowBrainer update. There is an alternative but it is ugly - save a copy of your current KnowBrainer command file (you will mine this file for commands which get overwritten). Update. Follow the detailed instructions I gave you in another post for massaging the newly updated KnowBrainer command file (but beware - this is an VERY finicky process).

"best practices" - in general these are tiny Basic scripts, just go with anything that works and don't worry about trying to make your script elegant, conserve resources or faster.

You could have used:

SendKeys "{Enter 2}", 1

you might not need to use the Clipboard at all - but you might, your mileage might very, try:

Sub Main

   SendKeys "{Enter 2}", 1

   SendKeys "@", 1

   SendKeys UCase (ListVar1), 1

   SendKeys "{Enter}", 1

End

Very rarely SendKeys fails in certain applications you might need to use the Clipboard:

Sub Main

   Clipboard = UCase (ListVar1)

   Wait 0.3' even though I have incredibly fast Ram 

' I ALWAYS need to add this "Wait 0.3" after any Clipboard operation

   SendKeys "{Enter 2}", 1

   SendKeys "@", 1

   SendKeys "^v", 1

   Wait 0.3' this is a Clipboard operation

   SendKeys "{Enter}", 1

End



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

-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

 09/10/2020 01:43 PM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 915
Joined: 04/03/2009

BTW, here are some links…

Dragon’s Basic scripting documentation:

https://www.nuance.com/products/help/dragon/dragon-for-pc/scriptref/Content/vbs/speechlinks_basic_language.htm

Dragon’s built-in commands documentation:

https://www.nuance.com/products/help/dragon/dragon-for-pc/scriptref/Content/scrptref/scripting_language_quickref.htm



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

-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

 09/10/2020 01:53 PM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Power Member

Posts: 58
Joined: 09/03/2020

Thank you! The first script worked beautifully in Dragon's advanced scripting. I'm using this only in Microsoft Word, and it seems to work fine using SendKeys rather than clipboard.

 

So in general, it sounds like it's best to not actually use Knowbrainer for writing any custom scripts, because they will all get overwritten eventually. So Knowbrainer is just like a big library of useful scripts.

 

Thanks for the links.

 

 



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

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

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

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