Page 1 of 1

needing help with hyperlinks

Posted: Sat Apr 05, 2014 1:00 am
by hands16
ok so i have to know what line and what number a word is in a paragraph when making it a link, is there any way to figure out what number the word is without manually counting

Re: needing help with hyperlinks

Posted: Sat Apr 05, 2014 1:43 am
by Simon
...what number a word is...
..what number the word is...
hmmm bit confused but
How about "wordOffset"?

Simon

Re: needing help with hyperlinks

Posted: Sat Apr 05, 2014 6:29 pm
by atout66
And to forward Simon you could use that function to retrieve the line number:

Code: Select all

function retrieveLineNumber tTxt,tString
   get the number of lines in char 1 to offset(tString,tTxt) of tTxt
   return tTxt -- the line number
end retrieveLineNumber 
Credit for this script belong to Craig :wink:

Kind regards.

Re: needing help with hyperlinks

Posted: Mon Apr 07, 2014 12:00 am
by jacque
atout66 wrote:And to forward Simon you could use that function to retrieve the line number:

Code: Select all

function retrieveLineNumber tTxt,tString
   get the number of lines in char 1 to offset(tString,tTxt) of tTxt
   return tTxt -- the line number
end retrieveLineNumber 
This is how we used to have to do it, but with LiveCode 5.5 came the new lineIndex and charIndex functions. Very handy.