Text selection code
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Text selection code
What is the code to select a region of text from one point to a specific word?
Thanks!
Thanks!
Re: Text selection code
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
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
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!
'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
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
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
LOL in my head I knew what I wanted to do!! Thanks I'll give that a go!
Re: Text selection code
Hi Whytey,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'
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
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
Re: Text selection code
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
Umm, really it's up to you and the way you organize your stack.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")?
so many ways to do that..

Happy coding

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
Re: Text selection code
Bonsoir Thierry,
Hand me the offset-inhalator quickly
Best
Klaus
I confess that I suffer heavily from that!Thierry wrote:if you have some regex-asthma so better stick with lineoffset and co

Hand me the offset-inhalator quickly

Best
Klaus
Re: Text selection code
Hallo Klaus,Klaus wrote:I confess that I suffer heavily from that!Thierry wrote:if you have some regex-asthma so better stick with lineoffset and co![]()
Hand me the offset-inhalator quickly![]()
....
Be happy

Thierry
Last edited by Thierry on Thu Nov 17, 2022 12:37 pm, edited 1 time in total.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
Re: Text selection code



In fact I really suffer from a light form of asthma and the device i use for inhaling looks a bit like yours minus the LC regex-disk:

At least it is ROUND

Re: Text selection code
Yep but mine contains a Rasperry board with LC already in..Klaus wrote:![]()
![]()
![]()
In fact I really suffer from a light form of asthma and the device i use for inhaling looks a bit like yours minus the LC regex-disk:
At least it is ROUND

and really sorry about your asthma; not really nice

Regards,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
Re: Text selection code
Thierry wrote:Yep but mine contains a Rasperry board with LC already in..


