Trying to Simplify Text Inputs

Creating macros. Working with QM.

Trying to Simplify Text Inputs

Postby colemd08 on Wed Apr 19, 2017 2:07 pm

I am attempting to create autotexts for parts of my EMR software that output various paragraphs of text, which themselves would have certain selectable words that can be alterated (with either drop down menus, free text, etc) to create unique statements. I have played around with QM for several hours to no avail. Does anybody have recommendations as to how I could go about this?

In the example below, I have several hotkeys that pull certain paragraphs. Is there a way to make the capitalized words/phrases hyperlinks to the menu or have a menu popup on hover over the word? I created one popup list, but the trigger is typing the actual word rather than hovering or clicking on the specific area I want those options to be available.

Any help or guidance is appreciated!

/b/i/p3

ACNE NEW MALE
*anm :"comes in today concerned about acne on his LOCATION. He reports having the acne for DURATION. During that time, he has used PAST TREATMENTS. He is currently using CURRENT TREATMENTS."

ACNE NEW FEMALE
*anf :"comes in today concerned about acne on her LOCATION. She reports having the acne for DURATION. During that time, she has used PAST TREATMENTS. She is currently using CURRENT TREATMENTS. Patient reports the acne DOES/DOES NOT flare around her menstrual cycle."

ACNE RETURN MALE
*arm :"is following up for acne on the LOCATION. He was last seen on DATE, and prescribed TREATMENT. He reports his acne is (IMPROVED, WORSENED, STABLE). Patient admits to TAKING/NOT TAKING his medication(s) as prescribed. Pt DENIES/ADMITS side effects from the medication(s)."

ACNE RETURN FEMALE
*arf :"is following up for acne on the LOCATION. She was last seen on DATE, and prescribed TREATMENT. She reports her acne is (IMPROVED, WORSENED, STABLE). Patient admits to TAKING/NOT TAKING her medication(s) as prescribed. Pt DENIES/ADMITS side effects from the medication(s)."


LOCATION :'"face."
LOCATION :'"face and chest."
LOCATION :'"face and back."
LOCATION :'"face, chest and back."
LOCATION :'"chest."
LOCATION :'"chest and back."
LOCATION :'"back."
colemd08
 
Posts: 3
Joined: Wed Apr 19, 2017 1:47 pm

Re: Trying to Simplify Text Inputs

Postby Gintaras on Wed Apr 19, 2017 4:52 pm

Better use dialog, not autotext.

Function dialog_paste_text_from_templates_123     ?

;Shows dialog where you can select texts and replace keywords such as LOCATION. OK pastes the text.
;Need to edit something. The TODO lines show where and what.


;TODO: add more texts. Edit if need. It is CSV format. For " use "". For new line use new line.
str csvTexts=
;anm = "comes in today concerned about acne on his LOCATION. He reports having the acne for DURATION. During that time, he has used PAST TREATMENTS. He is currently using CURRENT TREATMENTS."
;anf = "comes in today concerned about acne on her LOCATION. She reports having the acne for DURATION. During that time, she has used PAST TREATMENTS. She is currently using CURRENT TREATMENTS. Patient reports the acne DOES/DOES NOT flare around her menstrual cycle."
;arm = "is following up for acne on the LOCATION. He was last seen on DATE, and prescribed TREATMENT. He reports his acne is (IMPROVED, WORSENED, STABLE). Patient admits to TAKING/NOT TAKING his medication(s) as prescribed. Pt DENIES/ADMITS side effects from the medication(s)."
;arf = "is following up for acne on the LOCATION. She was last seen on DATE, and prescribed TREATMENT. She reports her acne is (IMPROVED, WORSENED, STABLE). Patient admits to TAKING/NOT TAKING her medication(s) as prescribed. Pt DENIES/ADMITS side effects from the medication(s)."

;TODO: add more words and replacements. It is CSV too. In replacement lists use | as separator.
str csvWords=
;LOCATION = "face|face and chest|face and back|and so on"
;DURATION = "several days|several months|and so on"


;_______________________________

ICsv xt._create
xt.Separator="="
xt.FromString(csvTexts)

ICsv xw._create
xw.Separator="="
xw.FromString(csvWords)
xw.InsertColumn(2)

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 390 188 "Paste text"
;4 Static 0x54000000 0x0 4 60 48 13 "Text"
;5 ListBox 0x54230101 0x200 4 76 124 80 "tex"
;6 Static 0x54000000 0x0 136 60 48 13 "Word"
;7 ListBox 0x54230101 0x200 136 76 96 80 "wor"
;8 Static 0x54000000 0x0 240 60 54 13 "Replacement"
;9 ComboBox 0x54230241 0x0 240 76 144 82 "rep"
;1 Button 0x54030001 0x4 8 168 48 14 "OK"
;2 Button 0x54030000 0x4 64 168 48 14 "Cancel"
;3 RichEdit20A 0x54233044 0x0 4 4 380 48 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040500 "*" "" "" ""

str controls = "5 7 9 3"
str lb5tex lb7wor cb9rep re3

if(!ShowDialog(dd &sub.DlgProc &controls)) ret
paste re3


#sub DlgProc v
function# hDlg message wParam lParam

int i c
str s r
ARRAY(str) a
sel message
,case WM_INITDIALOG
,c=id(5 hDlg)
,for(i 0 xt.RowCount) LB_Add c xt.Cell(i 0)
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
;OutWinMsg message wParam lParam
sel wParam
,case IDOK
,case IDCANCEL
,
,case LBN_SELCHANGE<<16|5 ;;texts
,_i=LB_SelectedItem(lParam); if(_i<0) ret
,s=xt.Cell(_i 1); s.setwintext(id(3 hDlg))
,c=id(7 hDlg)
,SendMessage c LB_RESETCONTENT 0 0
,for(i 0 xw.RowCount) if(findw(s xw.Cell(i 0))>=0) LB_Add c xw.Cell(i 0)
,SendMessage id(9 hDlg) CB_RESETCONTENT 0 0
,
,case LBN_SELCHANGE<<16|7 ;;words
,_i=LB_SelectedItem(lParam); if(_i<0) ret
,c=id(9 hDlg)
,SendMessage c CB_RESETCONTENT 0 0
,tok xw.Cell(_i 1) a -1 "|"
,for(i 0 a.len) CB_Add c a[i]
,
,case CBN_SELCHANGE<<16|9
,PostMessage hDlg message CBN_EDITCHANGE<<16|9 lParam
,case CBN_EDITCHANGE<<16|9
,;save the replacement in xw third column
,r.getwintext(lParam); if(!r.len) ret
,_i=LB_SelectedItem(id(7 hDlg)); if(_i<0) ret
,xw.Cell(_i 2)=r
,;get original text
,_i=LB_SelectedItem(id(5 hDlg)); if(_i<0) ret
,s=xt.Cell(_i 1)
,;replace
,for i 0 xw.RowCount
,,r=xw.Cell(i 2)
,,if(r.len) s.findreplace(xw.Cell(i 0) r 2)
,s.setwintext(id(3 hDlg))
ret 1


#sub Replace
function str&s str&var $name
TO_CBGetItem var
s.findreplace(name iif(var.len var name) 2)

Gintaras
Site Admin
 
Posts: 10254
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Trying to Simplify Text Inputs

Postby colemd08 on Sat Apr 22, 2017 9:00 pm

Thanks so much for the input! This is a big help!
colemd08
 
Posts: 3
Joined: Wed Apr 19, 2017 1:47 pm

Re: Trying to Simplify Text Inputs

Postby colemd08 on Tue Apr 25, 2017 8:02 pm

Gintaras (or others),

So, I've worked on this over the weekend, and it definitely is more refined than the auto texts! I have a few additional questions that I've run into:

1. Since its a Dialog and not an autotext, how do you typically trigger this? Can the dialog be triggered with a keyboard input? Or is it best converted into an executable file and run manually?

2. The output of this dialog will be pasted into a Firefox broswer window. I noticed when I run the dialog, I end up with a pasting error if I don't have Firefox running in the background immediately under QM. Is there a way to have the system, by default, maximize or bring to the front, the program (in this case Firefox) that it needs to paste into?

3. In the example you pasted (see portion below), you separate csvWords with a |. They work flawlessly. However, what if I want to be able to select multiple choices to be pasted (what would traditionally be a ctrl+ mouse click in Windows) rather than just one? Is that something I need a multibox for? I was having problems with the syntax.


;Shows dialog where you can select texts and replace keywords such as LOCATION. OK pastes the text.
;Need to edit something. The TODO lines show where and what.


;TODO: add more texts. Edit if need. It is CSV format. For " use "". For new line use new line.
str csvTexts=
;anm = "comes in today concerned about acne on his LOCATION. He reports having the acne for DURATION. During that time, he has used PAST TREATMENTS. He is currently using CURRENT TREATMENTS."
;anf = "comes in today concerned about acne on her LOCATION. She reports having the acne for DURATION. During that time, she has used PAST TREATMENTS. She is currently using CURRENT TREATMENTS. Patient reports the acne DOES/DOES NOT flare around her menstrual cycle."
;arm = "is following up for acne on the LOCATION. He was last seen on DATE, and prescribed TREATMENT. He reports his acne is (IMPROVED, WORSENED, STABLE). Patient admits to TAKING/NOT TAKING his medication(s) as prescribed. Pt DENIES/ADMITS side effects from the medication(s)."
;arf = "is following up for acne on the LOCATION. She was last seen on DATE, and prescribed TREATMENT. She reports her acne is (IMPROVED, WORSENED, STABLE). Patient admits to TAKING/NOT TAKING her medication(s) as prescribed. Pt DENIES/ADMITS side effects from the medication(s)."

;TODO: add more words and replacements. It is CSV too. In replacement lists use | as separator.
str csvWords=
;LOCATION = "face|face and chest|face and back|and so on"
;DURATION = "several days|several months|and so on"

Thanks.
colemd08
 
Posts: 3
Joined: Wed Apr 19, 2017 1:47 pm

Re: Trying to Simplify Text Inputs

Postby Gintaras on Wed Apr 26, 2017 4:32 am

1. Assign a keyboard trigger or any other trigger, or drag-drop to a toolbar. If the toolbar is attached to the Firefox window, it also solves the 2 problem.

2. Run the dialog macro only when Firefox is active. Or before the paste line insert "activate window" command.

3. Then need to replace the ComboBox control with a ListBox control that has multi-select style. Getting its selected items is not so simple, but not difficult. But I don't know what you'll do with multiple selected items in this macro.
Gintaras
Site Admin
 
Posts: 10254
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest