Page 1 of 1
Text selection code
Posted: Sun Jan 12, 2014 2:39 pm
by Whytey
What is the code to select a region of text from one point to a specific word?
Thanks!
Re: Text selection code
Posted: Sun Jan 12, 2014 2:44 pm
by Klaus
Hi,
open the dictionary -> Livecode: Menu: Help: Dictionary (API) and lookup "select".
And taking a look at these stack won't hurt either:
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
Re: Text selection code
Posted: Sun Jan 12, 2014 3:52 pm
by Whytey
Hi Klaus, thanks for your post I'm still struggling I have this huge stream of data and this thread I am interested in in the middle of it.
'Select item 244094102.
Nucleostemin depletion induces post-g1 arrest apoptosis in chronic myelogenous leukemia k562 cells.
Seyed-Gogani N, Rahmati M, Zarghami N, Asvadi-Kermani I, Hoseinpour-Feyzi MA, Moosavi MA.
Adv Pharm Bull. 2014;4(1):55-60. doi: 10.5681/apb.2014.009. Epub 2013 Dec 23.
PMID'
By using the code
on mouseUp
find "244" in field "Results2"
I can get to this thread but I am not sure how to select from this point up to the PMID at the end and copy and paste the selection into a box called "Box1"
I hope you can help! Thanks!
Re: Text selection code
Posted: Sun Jan 12, 2014 4:39 pm
by Klaus
Hi Whytey,
OK, I see that you
1. did not really mean "select"
2. did not mean "sort" for this in another thread
3. found a way to ask this question a third time today (Hint, hint!)
"find" is not the best way for your purpose, I would use "lineoffset" or
just "offset" or a combination of both here.
Best
Klaus
Re: Text selection code
Posted: Sun Jan 12, 2014 4:44 pm
by Whytey
LOL in my head I knew what I wanted to do!! Thanks I'll give that a go!
Re: Text selection code
Posted: Sun Jan 12, 2014 4:56 pm
by Thierry
Whytey wrote:I have this huge stream of data and this thread I am interested in in the middle of it.
'Select item 244094102.
Nucleostemin depletion induces post-g1 arrest apoptosis in chronic myelogenous leukemia k562 cells.
Seyed-Gogani N, Rahmati M, Zarghami N, Asvadi-Kermani I, Hoseinpour-Feyzi MA, Moosavi MA.
Adv Pharm Bull. 2014;4(1):55-60. doi: 10.5681/apb.2014.009. Epub 2013 Dec 23.
PMID'
Hi Whytey,
Regular expressions are also a nice and powerful way to go for this kind of problem,
except if you have some regex-asthma so better stick with lineoffset and co
Here is some code:
Code: Select all
if matchText( yourText, "(?ms)'Select item 244094102.\n(.*?)\nPMID'", gotit) then
put gotit
else
put "Not found!"
end if
Thierry
Re: Text selection code
Posted: Sun Jan 12, 2014 5:09 pm
by Whytey
Hi Thierry, brilliant thank you. Where shall I put this code, do I need to make a button that links to where the text is (In a box called "Results2")?
Re: Text selection code
Posted: Sun Jan 12, 2014 5:36 pm
by Thierry
Whytey wrote:Hi Thierry, brilliant thank you. Where shall I put this code, do I need to make a button that links to where the text is (In a box called "Results2")?
Umm, really it's up to you and the way you organize your stack.
so many ways to do that..
Happy coding
Thierry
Re: Text selection code
Posted: Sun Jan 12, 2014 5:57 pm
by Klaus
Bonsoir Thierry,
Thierry wrote:if you have some regex-asthma so better stick with lineoffset and co

I confess that I suffer heavily from that!
Hand me the offset-inhalator quickly
Best
Klaus
Re: Text selection code
Posted: Sun Jan 12, 2014 6:25 pm
by Thierry
Klaus wrote:
Thierry wrote:if you have some regex-asthma so better stick with lineoffset and co

I confess that I suffer heavily from that!
Hand me the offset-inhalator quickly
Hallo Klaus,
....
Be happy
Thierry
Re: Text selection code
Posted: Sun Jan 12, 2014 6:31 pm
by Klaus
Re: Text selection code
Posted: Sun Jan 12, 2014 6:42 pm
by Thierry
Yep but mine contains a Rasperry board with LC already in..
and really sorry about your asthma; not really nice
Regards,
Thierry
Re: Text selection code
Posted: Sun Jan 12, 2014 7:21 pm
by Klaus