Put items into ListMagic
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Put items into ListMagic
Hi
I have a textfield called "source_text" with several phrases/sentences in it. I would like to populate a simple ListMagic as follows:
- every sentence should be on one line in ListMagic
- remaining spaces at the beginning of line 2 to ... should be deleted
Can anyone help me – thanks a lot
mediaman
I have a textfield called "source_text" with several phrases/sentences in it. I would like to populate a simple ListMagic as follows:
- every sentence should be on one line in ListMagic
- remaining spaces at the beginning of line 2 to ... should be deleted
Can anyone help me – thanks a lot
mediaman
Re: Put items into ListMagic
MediaMan,
the following assumes that your sentence is always terminated by a full stop, or dot. It removes linebreaks before processing.
regards
Bernd
the following assumes that your sentence is always terminated by a full stop, or dot. It removes linebreaks before processing.
Code: Select all
on mouseUp
put field "SourceText" into tData
-- watch out for returns or paragraphs, it would create an empty line
replace return with empty in tData
repeat
-- find the next "."
put offset(".",tData) into aDot
-- if not found offset returns 0, aPoint would be 0
-- than we exit the repeat loop
if aDot = 0 then exit repeat
-- we found a dot
put char 1 to aDot of tData into tTestForSpace
-- remove spaces at beginning of text
repeat while char 1 of tTestForSpace is space
delete char 1 of tTestForSpace
end repeat
put tTestForSpace & cr after tDataOut
-- we just delete the data that has been processed from tData
delete char 1 to aDot of tData
end repeat
delete last char of tDataOut -- a return
put the number of chars of tDataOut
put tDataOut after msg
-- checkif there is data to put into the field
if tDataOut is "" or tDataOut is return then
answer "No Data to Fill in"
exit mouseUp
end if
put "TEXT" & return before tDataOut -- the header
-- put tDataOut into the ListMagic field
LMPopulate tDataOut
end mouseUp
Bernd
Re: Put items into ListMagic
Hi Bernd
This works like a charm – absolutely perfect - thanks .
Mediaman
This works like a charm – absolutely perfect - thanks .
Mediaman
Re: Put items into ListMagic
Hey Bernd
Suche definitiv jemanden, der mich bei der Entwicklung meiner kleinen Applikation unterstützt, hab noch tausend Fragen – natürlich gegen Euro
. Hättest Du Zeit und Lust?
Meld dich doch - leider kann ich dich nicht mit einer PM erreichen.
Danke
mm
Suche definitiv jemanden, der mich bei der Entwicklung meiner kleinen Applikation unterstützt, hab noch tausend Fragen – natürlich gegen Euro

Meld dich doch - leider kann ich dich nicht mit einer PM erreichen.
Danke
mm
Re: Put items into ListMagic
Hi MediaMan,
thanks for the offer. I answer in english so everyone can participate. There are some very experienced Rev developers on this list that offer professional development in RunRev.
As for the ones that speak german:
Mark Schonewille and Klaus Major come to mind
Klaus can be reached via http://www.major-k.de/
and Mark can be reached via http://economy-x-talk.com/
They both mention from time to time that they do commercial projects of varying scale.
I don't do contract work. No time, since I love to answer questions on the forum for free ...
So if you have specific questions go ahead, if you look for someone for an application see above.
Private messaging has been disbled because of too much spam, unfortunately.
regards
Bernd
thanks for the offer. I answer in english so everyone can participate. There are some very experienced Rev developers on this list that offer professional development in RunRev.
As for the ones that speak german:
Mark Schonewille and Klaus Major come to mind
Klaus can be reached via http://www.major-k.de/
and Mark can be reached via http://economy-x-talk.com/
They both mention from time to time that they do commercial projects of varying scale.
I don't do contract work. No time, since I love to answer questions on the forum for free ...

So if you have specific questions go ahead, if you look for someone for an application see above.
Private messaging has been disbled because of too much spam, unfortunately.
regards
Bernd
Re: Put items into ListMagic
Hi Bernd
I managed to get the whole thing working – your script helped a lot. Now I've got the problem that a sentence can not only be terminated by a period ("."), but also by ".»" (period/quotation marks), "?" (question mark) etc.
Thanks
MediaMan
I managed to get the whole thing working – your script helped a lot. Now I've got the problem that a sentence can not only be terminated by a period ("."), but also by ".»" (period/quotation marks), "?" (question mark) etc.
Thanks
MediaMan
Re: Put items into ListMagic
Hi MediaMan,
it is tricky to catch all of the possible sentence endings. Here is my shot at it. The list of possible sentence endings in my script is appendable. Quote is very tricky and probably not fully covered.
Anyways
regards
Bernd
it is tricky to catch all of the possible sentence endings. Here is my shot at it. The list of possible sentence endings in my script is appendable. Quote is very tricky and probably not fully covered.
Anyways
Code: Select all
on mouseUp
put field "SourceText" into tData
-- watch out for returns or paragraphs, it would create an empty line
replace return with empty in tData
-- a item list of possible sentence endings
put ".,!,?,»," & quote into tSentenceEndings -- add your sentence endings here
repeat
-- find the next sentenceEnding
-- put an impossible number for offset to find
-- into tCompare so we can test if anything was found
-- can not take 0 because offset 0 is not found
put length (tData) + 1 into tCompare
-- check possible endings and find the lowest occurence
-- = the nearest hit. Has to be greater then 0
repeat with i = 1 to the number of items of tSentenceEndings
put offset (item i of tSentenceEndings, tData) into aHit
-- catch quotes that are not at the end of sentence
if char aHit of tData is quote and char aHit + 1 of tData is not among the items of tSentenceEndings then next repeat
if aHit < tCompare and aHit > 0 then put aHit into tCompare
end repeat
if tCompare > length (tData) then exit repeat -- no sentence ending found, see above
-- test for e.g. ".»", i.e two possible sentence endings in a row
if char tCompare +1 of tData is among the items of tSentenceEndings then add 1 to tCompare
-- we found a sentence ending
put char 1 to tCompare of tData into tTestForSpace
-- remove spaces at beginning of text
repeat while char 1 of tTestForSpace is space
delete char 1 of tTestForSpace
end repeat
put tTestForSpace & cr after tDataOut
-- we just delete the data that has been processed from tData
delete char 1 to tCompare of tData
end repeat
delete last char of tDataOut -- a return
-- checkif there is data to put into the field
if tDataOut is "" or tDataOut is return then
answer "No Data to Fill in"
exit mouseUp
end if
put "TEXT" & return before tDataOut -- the header
-- put tDataOut into the ListMagic field
LMPopulate tDataOut
end mouseUp
Bernd