I am trying to extract text from the clipboard and use it to fill out fields on a website.
the clipboard would say something like....
Variably sized scanned areas from three slides, yada, yada, yada. These cells blah blah blah.
(intentional blank line)
Carcinoma
(blank line)
These cells display significant criteria of malignancy. blah blah blah. The end.
The website has three boxes for text.
The output into the form would look like this:
Box 1 "Description": Variably sized scanned areas from three slides, yada, yada, yada. These cells blah blah blah.
Box 2 "Interpretation": Carcinoma
Box 3 "Comment": These cells display significant criteria of malignancy. blah blah blah.
I cannot seem to extract the data correctly from the clipboard with the split command. Can you help? using "e" for enter may be totally incorrect. I was extrapolating from a previous snippet where I used "t" to divide at tabs.
{Description=split({clipboard}, "\e: (")[2]; trim=yes}{Interpretation=split({clipboard}, "\e")[4]; trim=yes}{Comment=split({clipboard}, "\e")[6]; trim=yes}{=Description}{key: tab}{=Interpretation}{key: tab}{=Comment}
Could I get a hand with this?
Thanks kindly,
Carol
Hey Carol,
Could you try something like this?
{values=splitregex({clipboard}, "[\r\n]+")}
{Description=values[1]}{Interpretation=values[2]}{Comment=values[3]}
{=Description}{key: tab}{=Interpretation}{key: tab}{=Comment}
Depending on where and how your data exists, you may also consider using the {site} command to get the data you need from any website, rather than copying it and then having to split it.
This is great. I usually write the report in Word and would like to copy paste and then execute one snippet to fill out the blank report. So the data doesn't exist on the website until I put it into this form.
How would I tweak it if I want that interpretation area to include multiple lines of text?
for example in this report all three of the middle lines need to go into the interpretation box. If I put a Tab at the end of the last interpretation line when I type in Word, and then alter the way the splitregex is written... would that me use more than one line there? This can vary from report to report, so it would be nice if one snippet could handle them all regardless.
example:
Cells are polygonal to rounded with a high N:C ratio and basophilic cytoplasm. Nuclei are round to oval with finely stippled chromatin and 1-2 small, distinct nucleoli. These cells display mild to moderate anisocytosis and anisokaryosis. Mitotic figures are not observed. Leukocytes are not increased over the expected contribution from blood. Infectious agents are not identified. Scan 2 shows moderate amounts of stain precipitate debris and rare keratinocytes.
Epithelial neoplasia with modest atypia, please see comment
Interp line 2
Interp line 3
Cytologic findings are consistent with an epithelial neoplasm of mammary origin. The epithelial cells display modest atypia and underlying malignancy (carcinoma) is of concern. Biopsy (incisional or excisional) followed by histopathologic examination is strongly recommended. Definitive characterization of mammary masses requires biopsy with histopathology to evaluate tissue architecture for stromal and vascular invasion, for grading, and prognosis. Aspiration of draining lymph nodes and thoracic radiographs may provide relevant clinical information.
Thank you.
Carol
If I understood correctly, you'd like to write a report that has paragraphs and can have new lines between them, but still be part of the same "section".
Would separating them by two lines work? For example
Section one
with multiple lines
still works
Section two is separated by two new lines, rather than a single line.
Still section two
Section three
You could modify this in any way that's suitable for you, for example three new lines to start a new section, instead of two.
Here's the updated code to separate section by two new lines. I updated only the "splitregex" command, as the rest can remain the same. If you'd like three new lines between each section, add an extra [\r\n]
.
{values=splitregex({clipboard}, "[\r\n][\r\n]")}
Two lines between sections would work great.
I seem to be struggling with the splitregex command edit though... OR microsoft Word is doing something hinkey.
Using this snippet: {values=splitregex({clipboard}, "[\r\n][\r\n]+"); trim=no}{Description=values[1]; trim=no}{Interpretation=values[2]}{Comment=values[3]}
{=Description; trim=yes}{key: tab}{=Interpretation}{key: tab}{=Comment}
It works fine when this is what is on the clipboard and I copy to the clipboard from this page in Chrome:
'section 1.
section 2 line 1
section 2 line 2
section 2 line 3
section 3 ajdfljadskfjakdjfakdjfa;kldsjf;akk'
but not when I copy the same text from a Word doc:
Preview in TB looks like this:
And it persists even if I am careful not to highlight the formatting P from last line...
Is there a way to write the snippet to get around this?
It seems to be struggling out of TextEdit on the Mac also....
so I realize this snippet works within the confines of Chrome, but is is struggling from other platforms. and I can't seem to troubleshoot it. very frustrating. Any help appreciated.
Thanks.
Carol