KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: DMO Advanced Scripting workaround for EPIC and Citrix via AHK
Topic Summary: Scripting in DMO sucks, AHK can help, here's some scripting that can connect the two.
Created On: 04/24/2022 09:38 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 DMO Advanced Scripting workaround for EPIC and Citrix via AHK   - NiptheZephyr - 04/24/2022 09:38 PM  
 DMO Advanced Scripting workaround for EPIC and Citrix via AHK   - NiptheZephyr - 04/24/2022 09:39 PM  
Keyword
 04/24/2022 09:38 PM
User is offline View Users Profile Print this message

Author Icon
NiptheZephyr
New Member

Posts: 13
Joined: 06/28/2020

Howdy everyone! Longtime fan of DMPE and it's advanced scripting. Lets me automate a huge portion of my note/EMR management to spend more time with patients or get home sooner. I moved to new state, got a job with a wonderful new hospital system that uses EPIC (hurray!), but unfortunately it uses DMO, and accesses both DMO and EPIC via Citrix (boo!). 

 

DMO's scripting capabilities are...lackluster. The most it has is fairly good Step-By-Step commands, compared to DMPE's advanced scripting and ability to use <lists>/ListVars, and just variables in general. As an example, you want to delete 10 sentences up? Get ready to click "new step" select "hotkey", press "shift up", select "hotkey", and press "delete". Now do that 10 times. Compare that to actual advanced scripting, something along the lines of +{up 10}{delete}. Or at least something similar, forgive me if it's missing "'s or the like, it's been many months since I actually did some scripting in it. Finally, DMO lacks the basic ability to click on the screen, allowing only keystrokes/key combinations.

 

So, in order to get around some of these deficits, I've been using AutoHotKey, a free, very straightforward scripting language with some great documentation, with practically all the benefits of VBS or Dragon's Advanced scripting. The biggest problem with it is that it uses keyboard and mouse inputs to activate. While it can be triggered by something like Windows Speech Recognition typing, DMO typing fails to do so, or at least DMO and EPIC accessed through Citrix, like my system uses. So, I've developed a workaround that I want to share with y'all. I've also posted this in "DMPE, DMO and EMRs " too, since people who visit there may be the oes to find it most useful.

 

So, how it works first:

1. You design your "advanced scripting" in AHK. Set it to be triggered by a one word hotstring (::hotstring:

2. Make a DMO step-by-step command that types the first part of the hotstring (::hotstring), highlights it, then cuts it to the clipboard. 

 

So long as you have the below code in your .ahk document that is running, that's all you need! The script will execute. The .ahk script has code at that top which fills an array with a list of all the hotstrings in the .ahk document itself. It monitors the clipboard, and when what is put on the clipboard matches a hotstring, it runs it via the function at the bottom.

Limitations!

1. Current verson only looks at one word hotstrings. 

2. I have it set up so that anything else that is copied with but after the hostring is put into a variable for use (i.e. ::hotstring additionalWordsHerePutIntoAVariableAsAString). This "limitation" is on the DMO end; since it doesn't use "listVars", you'll have to verbalize what you'll want copied on a new line (so you don't copy unintentional stuff), then have your DMO Step-By-Step command {home} to the beginning of that line before it types your ::hotstring, then {end}, shift{home}, then cut to capture the whole thing.

3. If you are in the same situation as myself, you'll need to find a place for DMO to actually type its ::hotstring in EPIC. Meaning, Citrix makes everything look like an image, no access to "Controls", and if you are on a screen that doesn't have an edit DMO can type into (like your patient schedule), you'll have to bring something up for it to type into. I've found that bringing up a search bar gives you an edit to type into. The keystroke combo to bring up the search bar is either alt{space} or ctrl{space}, can't remember which right now. 

 

So, on to the ahk script/coding. Note that a comment is anything following a ; or between /* */. 

Begin AHK coding which you would put into a new .ahk under the autoexecute section:

;=====================================

;=====================================

;      ---Global Variables---

 

;=====================================

;Global Array holding the list of hotstrings in this script

 

Global ahkScriptsArray := {}

 

;=====================================

;Declared Global Variable to hold additional information for manipulation.

 

Global Input := ""

 

;=====================================

;    ---Additional Auto-Execute stuff---

 

;=====================================

;part that pulls the ::hotstrings:: out of this .ahk document and puts it into the array.

FileRead, fileInfoVar, %A_ScriptFullPath%re">

 

While pos := RegExMatch(fileInfoVar, "\R(::\w+)::", m, pos ? pos + StrLen(m) : 1)

ahkScriptsArray.Push(m1)

 

;=====================================

;Monitors for the clipboard to change, to compare to the below called function, which should compare to the hotstrings.

OnClipboardChange("DragonCompare")

 

 

;=====================================

;Put your "Advanced Scripting" ::hotstrings below here:

 

 

;=====================================

;Functions section, having the part that compares your clipboard to your ::hotstrings

DragonCompare() 

{

For A , hotString in ahkScriptsArray

{

RegExMatch(Clipboard, "(?P<ClipCompare>(?<!.)::\w*\b)(?P<Input>.*)", var)

If (hotString = varClipCompare)

{

Input := varInput

Try GoSub % varClipCompare

Input := ""

Return

}

Else

Continue

}

Return 

}

End AHK coding.

 

Hope this helps someone, as DMO's lack of functionality has frustrated me to know end, and knowing others have benefited from my frustration coding will make it worth it.

 04/24/2022 09:39 PM
User is offline View Users Profile Print this message

Author Icon
NiptheZephyr
New Member

Posts: 13
Joined: 06/28/2020

Couple of additional useful bits of information:

1. If you want to pull in patient demographic information through EPIC's .SmartLinks, type the .phrase to bring it in, highlight it, cut it, assign the clipboarded info to a variable. From there you can manipulate. See my script below for how I use the patient's age to calculate their moderate vs high intensity exercise heart rates to put into their after visit summary:

 

Edited for Clarity:

BEGIN CODE:

 

 

Sleep 200 ;lets the hotstring get deleted

OldClip := clipboard

Send .age{space}^+{left 2}^x

Sleep 400 ;needed to be this long before it'd process the above steps.

mathsVar := clipboard

RegExMatch(mathsVar, "\d*", mathsVar)

modIntEx := Ceil((220-mathsVar)*0.6)

highIntEx := Ceil((220-mathsVar)*0.8)

var1 = 

(

Moderate Intensity Exercise of 150 min/week at %modIntEx% bpm 

Or

High Intensity Exercise of 75 min/week at %highIntEx% bpm.

)

PasteVariable(var1)

Sleep 200

clipboard := OldClip

 

 

END CODE

 

Sorry, the script for my PasteVariable function is as follows:

 

BEGIN CODE:

 

 

PasteVariable(variable)

;in order to get the below to work in notepad++, needed to add in the StrPut and VarSetCapacity stuff. This was taken from jeeswg's post on this thread: https://www.autohotkey.com/boards/viewtopic.php?t=38715

{

;Sleep, 200 ;time for the hoststring to self delete.

ControlGetFocus, activeControlVar, A

If WinActive("ahk_class Notepad++")

{

vSize := StrPut(variable, "UTF-8") +2

VarSetCapacity(vUtf8, vSize, 0)

StrPut(variable, &vUtf8, "UTF-8")

Control, EditPaste, % vtf8, %activeControlVar%, A

}

Else

{

Control, EditPaste, %variable%, %activeControlVar%, A

}

Sleep, 200

ControlGetText, controlText, %activeControlVar%, A

If !InStr(controlText, variable)

{

Sleep, 200

OldClip := clipboard ;saves current clipboard as separate variable to not lose it

Sleep, 200

clipboard := variable

Send ^v

Sleep, 400

clipboard := OldClip

}

}

END CODE


 

 

2. If you are in the same situation, you may want to manipulate your notes text, but since DMO/EPIC accessed through Citrix doesn't let you pull the text from your note, here is my workaround: have the script put a verbal, F3 searchable marker where you want the text to go. ctrl{end} to the bottom, place a second marker. Type/pull in your EPIC .phrases, place an end marker. F3 search your 2nd marker, ctrl + shift {end} to the bottom, cut it. Manipulate the info via coding however you need, F3 search to the first marker, paste it. Done. Only disadvantage, it will remove all formating, and gets rid of the .SmartLinks. My coding below:

 

 

BEGIN CODE:

 

 

 

OldClip := clipboard	;Saves whatever was on the clipboard prior to editing
	Sleep 200				;Gives time for the hotstring to delete
	Send ---returnMarker---	;Sets a marker to jump back to after manipulation
	Send ^{end}{enter}		;Gets to the end of note so you don't screw anything else up.
	Send ---beginMarker---{enter}	;Sets another marker
;using the native program, do whatever key combos you need to do to gather whatever info you needed.	
	Sleep 500
	Send ---endMarker---	;Puts a final marker at the end for manipulation
	Sleep 200
	Send ^f					;opens search box for navigation
	Sleep 200
	Send ---beginMarker---{enter}{esc}	;navigates to just above the pulled in text
	Sleep 500
	Send ^+{end}^x			;Cuts everything you want to manipulate and puts it on the clipboard
	Sleep 200
;RegEx or manipulate the gathered info however you need.
	Sleep 200
	Send ^f					;search box
	Sleep 200
	Send ---returnMarker---{enter}{esc}^v	;back to the spot in your note/program you need to, then paste the manipulated data.

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

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