Page 1 of 1
How extract linktext in fld?
Posted: Sun May 27, 2012 8:29 am
by Partenaire
Hi,
I would like to extract linktext into field and put this list of group words into another field.
my code work but the result is that alls words linked are extracted.
Code: Select all
on mouseUp
repeat with i = 1 to the num of words of fld "text1"
if the textStyle of word i of fld "text1" is "link" then
put the htmltext of word i of fld "text1" after tlistHtml
end if
end repeat
put tlistHtml into fld "fldlinkword"
set the htmlText of fld "fldlinkword" to tlisthtml
end mouseUp
exemple :
le domaine du fan is a group text
the result in my field is :
le
domaine
du
fan
and my hope is
le domaine du fan
Thank you for your help
Eric
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 9:56 am
by Dixie
Eric...
Code: Select all
on mouseUp
repeat with count = 1 to the number of words of fld 1
if the textstyle of word count of fld 1 = "link" then
put word count of fld 1 & space after fld 2
end if
if the textStyle of word count of fld 1 <> "link" AND the textStyle of word (count - 1) of fld 1 = "link" then
set the textStyle of the last line of fld 2 to "link"
put cr after fld 2
end if
end repeat
end mouseUp
Dixie
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 11:04 am
by Partenaire
Dixie, thank for your reply.
I think my post no clear enought.
I want to extract linktext in fld 1 and put the resul into fld 2
fld 1 look like :
Christian Bobin citations
Aimer c'est prendre soin de la solitude de l'Autre, sans prétendre la combler.
With my code the result is in the fld 2
Christian
Bobin
soin
when the textstyle of several words are link, I'd like to get into the fld 2
Christian Bobin
Sorry , my english is not very good. Is this clearer!
Eric
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 11:05 am
by jmburnod
Bonjour Eric,
Dixie is faster than me one more time.
This script avoid space after each line of the result and delete a return in the last line of the result if there is one.
Code: Select all
on mouseUp
put empty into fld "fldlinkword"
repeat with i = 1 to the num of words of fld "text1"
put the textstyle of word i of fld "text1" into tStyle
if tStyle = "link" then
put word i of fld "text1" & " " after fld "fldlinkword"
end if
if tStyle <> "link" and the textStyle of word (i - 1) of fld "text1" = "link" then
delete char -1 of line -1 of fld "fldlinkword" -- there is a " " after each line
set the textStyle of line -1 of fld "fldlinkword" to "link"
put cr after fld "fldlinkword"
end if
wait 1 milliseconds
end repeat
if char -1 of fld "fldlinkword" = cr then delete char -1 of fld "fldlinkword"
end mouseUp
Best regards
Jean-Marc
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 11:12 am
by jmburnod
Eric,
Dixie script work for me.
It return
Christian Bobin
soin
into fld 2
Quelle version de LiveCode utilisez-vous ?
Jean-Marc
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 11:31 am
by Partenaire
Hi Jean Marc
You speak French

. je reprend donc en français
Je souhaite récupérer dans le fld 1 tous les hypertext (les mots ou groupe de mots) et les données qui leurs sont attachés et ensuite les placer dans le fld 2. Ces hypertext restent actifs quant je clique sur une ligne du fld 2
Avec votre proposition de code les liens sont perdus et les hypertext d'un seul mot, mais se trouvant sur une même ligne dans le fld 1 sont concaténés sur une même ligne dans le fld 2.
Sorry for Dixie for this french little conversation.
Thank you for alls
Eric
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 12:07 pm
by jmburnod
Hi Eric,
Your explanation is clear
If you want exchange in french, i suggest you move on the french forum
http://fr.groups.yahoo.com/group/livecodefr/
My english is also terrible, but the users of this forum live with that (and it seem i progress in english

)
les hypertext d'un seul mot, mais se trouvant sur une même ligne dans le fld 1 sont concaténés sur une même ligne dans le fld 2
Not for me
Christian Bobin citations Aimer c'est prendre soin de la solitude de l'Autre, sans prétendre la combler.
return
Christian Bobin
soin
sans
with LiveCode 5.0, Which version of LiveCode do you use ?
Je souhaite récupérer dans le fld 1 tous les hypertext (les mots ou groupe de mots) et les données qui leurs sont attachés et ensuite les placer dans le fld 2
Il semble que le linktext du group Christian Bobin est vide
It seem the linktext of word 1 to 2 of veld 1 = empty
Does Dixie can confirm the linktext is the key ?
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 12:24 pm
by Dixie
Hi..
You guys are losing me ... I thought that Eric wanted all the link text in fld 1 to be pulled out and put into fld 2 ... on separate lines ?... maybe I mis-understood...
be well
Dixie
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 12:55 pm
by jmburnod
Hi Dixie,
Yes you understand right.
Eric want also the text of the links ("linkText" ?) but all linktext are empty
I can't open the linktext stack
Is LC 5.5 ?
Be well
Jean-Marc
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 1:02 pm
by Partenaire
Hi Dixie,
That right I want to do that. The only problem and when the Hyperttext is for exemple two word i have two lines in the fld 2, and i 'd like to get only one line.
The dictionary say
Comments:
Text with its textStyle set to "link" is treated specially by the clickText, clickChunk, mouseText, and mouseChunk functions: a style run of grouped text is treated as a single word. This makes grouped text handy to use for hypertext or "clickable text" features.
.
Maybe if we use htmltext like in my firt code we need use a property of grouped text?
Best regards
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 4:05 pm
by Dixie
Eric...
This works
Code: Select all
on mouseUp
put empty into fld 2
repeat with count = 1 to the number of words of fld 1
if the textstyle of word count of fld 1 = "link" then
put word count of fld 1 & space after fld 2
end if
if the textStyle of word count of fld 1 <> "link" AND the textStyle of word (count - 1) of fld 1 = "link" then
set the textStyle of the last line of fld 2 to "link"
--put count - (the number of words of the last line of fld 2 ) & comma & count - 1
put the linkText of word count - (the number of words of the last line of fld 2 ) to count - 1 of fld 1 into theTextToCarry
set the linkText of the last line of fld 2 to theTextToCarry
put cr after fld 2
end if
end repeat
delete the last char of fld 2
end mouseUp
I have attached the ammended stack... the linktext from the links in fld 1 is carried to the links that are listed in fld 2.
be well
Dixie
Re: How extract linktext in fld?
Posted: Sun May 27, 2012 9:22 pm
by Partenaire
Hi Dixie, fine it is OK.
Your code work very well. tomorrow, I will try to understand this code portion
put the linkText of word count - (the number of words of the last line of fld 2 ) to count - 1 of fld 1 into theTextToCarry
.
Thank you very munch.
Have a nice evenning
Best regards
Eric