KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Help putting several selections into variables and then reusing all variables into a script
Topic Summary:
Created On: 05/20/2020 06:10 AM
Status: Post and Reply
Linear : Threading : Single : Branch
 05/20/2020 06:10 AM
User is offline View Users Profile Print this message

Author Icon
dicdoc
Top-Tier Member

Posts: 207
Joined: 07/31/2014

Hi Guys,

I'm trying to put some semi automation in creating patient admistrative records. I regularly receive new patient information from several sources. It can be an email, scanned fax or electronic documents, OCrized pdfs, with 1st name, 2nd name birth date and so on. So there is no predefined layout. 

Only reading and habit tell me what's family name, 1st name, birthda date and so on.

I had in my mind having several scripts where I can select any text portion, then say "copy 1st name", or "copy family name" or "copy social security number". In the end all these individual scripts should put the cpied content into a correct variable. When I got all the info needed, then I'd like to be able to gather all these variable and paste them into my web app, which has a structured content input, and paste the right variable content in the need field.

Do you have any idea how I cloud do ?

Is it possible to store each copied variable into a same temporary text file and retrieve it with another script ?

Thanks for you help



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

Memory: 16GB Microphone Brand and Model: Rec Mic II Operating System: win 10, latest update; Surface Book 2, Processor (CPU) Type & Speed: I7 8650 Soundcard Brand and Model: none Speech Software: Dragon Medical Practice Edition, french version: 4.0 Using KnowBrainer?: No

 05/20/2020 11:12 AM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 789
Joined: 04/03/2009

If I was doing this…

I would write a simple Windows Form application in C++/C# with a text field for each variable. Each text field would be appropriately labeled/tab stopped to allow easy voice activation (each would also have a keyboard short for activation) and would be Select-And-Say; there would probably be a "transfer" button. I would write a single Dragon/KnowBrainer script on the order of:
Grab [VariableList]

(I would use something other than Copy for the first word to avoid confusion with other similar commands. Since your script name will be in French you might replace Copier with Saisir or something similar.)

Your list would contain things like:

First Name

Last Name

etc.

The script would remember the currently active window, copy the selected text into the clipboard, activate the Windows Form application, parse the ListVar1 to determine the correct text field and paste the contents of the clipboard into that text field; it would then reactivate that “currently active window” that it remembered originally. The transfer button would activate your web-based form and paste all the non-empty text fields of the Windows Form application into the web-based form.

If this seems like a good way to go, contact me via email if you need help with the Windows Form application or the script

Another way to do it would be to manipulate a (text, XML) file (this can all be done within a script): for each new input form…

Create the file

write token pairs (VariableName non-,-separator Value; e.g. First Name|John)

so the file will end up looking something like:

FirstName|John

StreetAddress|123 Main Street

LastName|Boswell

City|Hometown

(note that the entries can be in random order as we will parse the text file line by line using the variable data based on the variable name).

After using the file to fill out the web-based form the script will delete the file.

 



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

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Word 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

 05/20/2020 06:43 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 37503
Joined: 10/01/2006

We just added Copy into KnowBrainer. You can update KnowBrainer or just copy the following script into Dragon, if it fills your need. Here's how it works:

 

If we open Excel and then highlight any text in a browser, email etc., we can say Tab Copy to copy the highlighted text to the clipboard, switch to Excel, paste the contents of the clipboard into Excel, move to the right (next cell) and switch back to the original application (so that you can repeat the action on your next selection). Of course this is only a single shot but if needed, it wouldn't take much to loop the following script:

Sub Main
SendKeys "^c"
Wait 0.5
SendKeys "%{Tab}"
Wait 1
SendKeys "^v"
Wait 0.5
If ListVar1 = "Tab" Then SendKeys "{Tab}"
If ListVar1 = "Right" Then SendKeys "{Tab}" If ListVar1 = "Left" Then SendKeys "+{Tab}" If ListVar1 = "Up" Then SendKeys "{Up}" If ListVar1 = "Down" Then SendKeys "{Down}" Wait 1 SendKeys "%{Tab}" End Sub


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

Forum Mission Statement
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ext 1



 05/26/2020 12:49 PM
User is offline View Users Profile Print this message

Author Icon
dicdoc
Top-Tier Member

Posts: 207
Joined: 07/31/2014

Finally Guys I choose another option more suited to my needs, which is to pickup up pieces of info from different sources and compile them into a web app's fomular :
- 1 macro that copies successives selection into clipboard , with a home-made markup that borders each piece of information
- 1 macro that decodes the clipboard content, thanks to markup and put all piece of info into each variables I need in my context, and then pastes them into each fields

For those interrested :

macro 1 : getting info
======
Sub Main
Dim temp1, MarkUp as String
'Dim Istart, Iend as Integer
Dim CV, NM, PN, DN, PY, CO, RU, CL, NP, TM, TF, SN, temp, temp2, segment as String
Dim fields, tempfield, SumUp as String
Dim Istart, Iend, L, tabu, dwn as Integer


fields = "CV, NM, PN, DN, PY, CO, RU, CL, NP, TM, TF, SN, "
fields = replace(fields, ", ", "")
'msgbox(fields & ". Lenght = " & len(fields) & "")


temp1 = Clipboard
wait.3
If ListVar1 = "naissance" Then MarkUp = "DN"
If ListVar1 = "nom" Then MarkUp = "NM"
If ListVar1 = "prénom" Then MarkUp = "PN"
If ListVar1 = "chez" Then MarkUp = "CO"
If ListVar1 = "rue" Then MarkUp = "RU"
If ListVar1 = "complément" Then MarkUp = "CL"
If ListVar1 = "numéro" Then MarkUp = "NP"
If ListVar1 = "fixe" Then MarkUp = "TF"
If ListVar1 = "natel" Then MarkUp = "TM"
If ListVar1 = "sinistre" Then MarkUp = "SN"
If ListVar1 = "Madame" OR ListVar1 = "Monsieur" Then
MarkUp = "CV"
temp2 = ListVar1
GoTo TreatVariable
End If
If ListVar1 = "France" Then
MarkUp = "PY"
temp2 = ListVar1
GoTo TreatVariable
End If

sendkeys "^c", 1
wait.3
temp2 = Clipboard
wait.3
temp2 = trim(temp2)
'Msgbox(ListVar1)


TreatVariable:
'
' verifies if the current variable already exists and in this case
' deletes the existing markup and it's content
' before applying new value
'
'Msgbox(ListVar1 & " - " & MarkUp)
Istart = instr (temp1, "[<" & MarkUp & "]")
Iend = instr (temp1, "[" & MarkUp & ">]")
'msgbox("Istart = " & Istart & " - " & "Iend = " & Iend & " - ")

If Istart > 0 AND Iend = 0 Then
Msgbox ("Discordance : No End Markup for " & MarkUp & CHR(13) & temp1, vbMsgBoxSetForeground)
Stop
End If
If Istart = 0 AND Iend > 0 Then
Msgbox ("Discordance : No Start Markup for " & MarkUp & CHR(13) & temp1, vbMsgBoxSetForeground)
Stop
End If

If Istart = 0 AND Iend = 0 Then ' in case no discordance and no double
GoTo PutVariable
End If

'
' Last case : double
'
'MsgBox ("Doublon !", vbMsgBoxSetForeground)
'Msgbox("" & mid(temp1, Istart, Iend-Istart+5) & "" )
temp1 = replace(temp1, mid(temp1, Istart, Iend-Istart+5), "")



PutVariable:
If ListVar1 = "naissance" Then
If len (temp2) < 9 Then
If val (mid(temp2, 7, 2)) < 55 then temp2 = left(temp2, 6) & "20" & mid(temp2, 7, 2)
If val (mid(temp2, 7, 2)) >= 55 then temp2 = left(temp2, 6) & "19" & mid(temp2, 7, 2)
End If
End If


'
' prépare réc des variables existantes
'
For i = 1 to ((len(fields)/2))
tempfield = mid(fields, (((i-1)*2)+1), 2)
Istart = instr (temp1, "[<" & tempfield & "]")
Iend = instr (temp1, "[" & tempfield & ">]")
If Istart = 0 AND Iend = 0 Then GoTo SuiteCycle
SumUp = SumUp & CHR(13) & tempfield & " : " & mid(temp1, Istart+5, Iend-(Istart+5) )

SuiteCycle:
next i

' affiche la nouvelle variable suivi du réc des existantes
'
Msgbox(ListVar1 & " : " & temp2 & CHR(13) & CHR(13) & SumUp, vbMsgBoxSetForeground)


temp1 = temp1 & "[<" & MarkUp & "]" & temp2 & "[" & MarkUp & ">]"
Clipboard temp1
wait.3
End Sub



Macro 2 : putting info
======
Dim CV, NM, PN, DN, PY, CO, RU, CL, NP, TM, TF, SN, temp, temp2, segment as String
Dim fields, tempfield as String
Dim Istart, Iend, L, tabu, dwn as Integer

fields = "CV, NM, PN, DN, PY, CO, RU, CL, NP, TM, TF, SN, "
fields = replace(fields, ", ", "")
'msgbox(fields & ". Lenght = " & len(fields) & "")
SetMousePosition 1, 500, 400 ' écarte la souris de la liste déroulante
setmicrophone 0
temp = Clipboard

For i = 1 to ((len(fields)/2))
tempfield = mid(fields, (((i-1)*2)+1), 2)
'msgbox("" & i & " : " & tempfield)

Istart = instr (temp, "[<" & tempfield & "]")
Iend = instr (temp, "[" & tempfield & ">]")

If Istart > 0 AND Iend = 0 Then
Msgbox ("Discordance : No End Markup for " & tempfield & CHR(13) & temp, vbMsgBoxSetForeground)
Stop
End If
If Istart = 0 AND Iend > 0 Then
Msgbox ("Discordance : No Start Markup for " & tempfield & CHR(13) & temp, vbMsgBoxSetForeground)
Stop
End If

If Istart = 0 AND Iend = 0 Then GoTo PutVariable



L = Iend-(Istart+5)
segment = mid(temp, Istart+5, L)
'msgbox("Istart = " & Istart & " - " & "Iend = " & Iend & " - " & segment )
'msgbox("Iend = " & Iend)
'msgbox ( "" & mid(temp,Istart+5, Iend-(Istart+5)) & "")

If tempfield = "CV" Then CV = segment
If tempfield = "NM" Then NM = segment
If tempfield = "PN" Then PN = segment
If tempfield = "DN" Then DN = segment
If tempfield = "PY" Then PY = segment
If tempfield = "CO" Then CO = segment
If tempfield = "RU" Then RU = segment
If tempfield = "CL" Then CL = segment
If tempfield = "NP" Then NP = segment
If tempfield = "TM" Then TM = segment
If tempfield = "TF" Then TF = segment
If tempfield = "SN" Then SN = segment

GoTo PoursuiteDuCycle
'DN = mid(temp,Istart+5, Iend-(Istart+5))

PutVariable:
If tempfield = "CV" Then CV = "Madame"

If tempfield = "NM" Then
Msgbox ("Il manque le nom, veuillez le rajouter en sélectionnant l'info et disant 'Fiche Nom'", vbMsgBoxSetForeground )
Stop
End If

If tempfield = "PN" Then
Msgbox ("Il manque le prénom, veuillez le rajouter en sélectionnant l'info et disant 'Fiche Prénom'", vbMsgBoxSetForeground )
Stop
End If

If tempfield = "DN" Then DN = "01.01.1900"
If tempfield = "PY" Then PY = ""
If tempfield = "CO" Then CO = ""
If tempfield = "RU" Then RU = ""
If tempfield = "CL" Then CL = ""
If tempfield = "NP" Then NP = ""
If tempfield = "TM" Then TM = ""
If tempfield = "TF" Then TF = ""
If tempfield = "SN" Then SN = ""

PoursuiteDuCycle:

next i

TransferVariable:
sendkeys "^f", 1
wait.1
sendkeys "Civilité", 1
wait.1
sendkeys "{enter}", 1
wait.1
sendkeys "{enter}", 1
wait.1
sendkeys "{esc}", 1
wait.1


sendkeys "{tab}", 1 ' va au champ civilité
wait.1


sendkeys "{up}", 1 ' active la liste déroulante civilité
wait.3
sendkeys "{up 2}", 1 ' ràz de la liste déroulante civilité

wait.1
If CV = "Madame" then
sendkeys "{down}", 1
wait.1
End if
sendkeys "{enter}", 1 ' valide le choix de l'item sélectionné de la liste
wait.1


sendkeys "{tab 2}", 1 ' va au champ Nom
wait.1


Clipboard NM
wait.2
sendkeys "^v", 1
wait.1


sendkeys "{tab}", 1 'va au champ suivant (prénom si c'est un homme)
wait.2
If CV = "Madame" then
sendkeys "{tab}", 1 ' Si civilité = Madame, il y a un champ de plus à sauter : Nom de jeunne fille
wait.2
End if


Clipboard PN
wait.2
sendkeys "^v", 1
wait.2


sendkeys "{tab}", 1 ' va au champ Date de Naissance
wait.2


Clipboard DN
wait.2
sendkeys "^v", 1
wait.1


msgbox("TEST")


Dim delai1, delai2, delai3 As Double, BtnTxt As String
BtnTxt = "SUIVANT"
'msgbox (BtnTxt)
delai1 = 0.1
delai2 = 0.2
delai3 = 0.5

sendkeys "^f", 1
wait delai1
sendkeys BtnTxt, 1
wait delai1
sendkeys "{ENTER}", 1
wait delai1
sendkeys "{ENTER}", 1
wait delai1
sendkeys "{ESC}", 1
wait delai1
sendkeys "{ENTER}", 1
wait delai2

Begin Dialog UserDialog 700, 100, 300, 500, "Instructions macro 'fiche création'"
Text 10,10,200,70,"Validez 'SAISIR PLUS...', " & CHR(13) & "puis cliquez 'Onglet Adresses'," & CHR(13) & " puis revenez sur ce dialogue avec Alt-Tab " & CHR(13) & "et cliquez 'OK' pour avancer dans les étapes de la macro"
OKButton 80,90,40,20
End Dialog
Dim dlg1 As UserDialog
Dialog dlg1 ' show dialog (wait for ok)

if NP = "" Then Goto Telephone

BtnTxt = "Domicile"
'msgbox (BtnTxt)
delai1 = 0.0
delai2 = 0.1
delai3 = 0.5

sendkeys "^f", 1
wait delai1
sendkeys BtnTxt, 1
wait delai1
sendkeys "{ENTER}", 1
wait delai1
sendkeys "{ESC}", 1
wait delai1

sendkeys "{tab}", 1
wait.1
If PY = "France" Then
Clipboard PY
sendkeys "^v", 1
wait.1
End If

sendkeys "{tab}", 1
wait.1
Clipboard CO
sendkeys "^v", 1
wait.1


sendkeys "{tab}", 1
wait.1
if RU = "" Then RU = "A définir"
Clipboard RU
sendkeys "^v", 1
wait.1

sendkeys "{tab}", 1
wait.1
Clipboard CL
sendkeys "^v", 1
wait.1


Telephone:
If TF = "" AND TM = "" Then GoTo Commentaire

Begin Dialog UserDialog 700, 100, 300, 500, "Instructions macro 'fiche création'"
Text 10,10,200,70,"" & "cliquez 'Onglet Téléphones'," & CHR(13) & "Choisissez le type de No et pointez dans le champ 'numéro'" & CHR(13) & " puis revenez sur ce dialogue avec Alt-Tab " & CHR(13) & "et cliquez 'OK' pour avancer dans les étapes de la macro"
OKButton 80,90,40,20
End Dialog
Dim dlg2 As UserDialog
Dialog dlg2 ' show dialog (wait for ok)

If TM <> "" AND TF <> "" Then
Clipboard TM
End If
Clipboard TF
sendkeys "^v", 1
wait.1



Commentaire:
If SN = "" Then Stop

Begin Dialog UserDialog 700, 100, 300, 500, "Instructions macro 'fiche création'"
Text 10,10,200,70,"" & "cliquez 'Onglet Commentaire'," & CHR(13) & "" & CHR(13) & " puis revenez sur ce dialogue avec Alt-Tab " & CHR(13) & "et cliquez 'OK' pour avancer dans les étapes de la macro"
OKButton 80,90,40,20
End Dialog
Dim dlg3 As UserDialog
Dialog dlg3 ' show dialog (wait for ok)
Clipboard SN
sendkeys "^v", 1
wait.1


Clipboard temp




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

Memory: 16GB Microphone Brand and Model: Rec Mic II Operating System: win 10, latest update; Surface Book 2, Processor (CPU) Type & Speed: I7 8650 Soundcard Brand and Model: none Speech Software: Dragon Medical Practice Edition, french version: 4.0 Using KnowBrainer?: No

Statistics
31621 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 2 users logged in.
The most users ever online was 3936 on 09/08/2015 at 11:44 AM.
There are currently 307 guests browsing this forum, which makes a total of 309 users using this forum.

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