the formattedText of
Posted: Thu Oct 22, 2009 10:52 am
Dear Runtime users,
I have worked through the "Working with text" tutorial. When it comes to inserting text, the following code snipped is provided:
on mouseUp
repeat with i = 1 to the number of lines in field "sample text"
put "Some text. " before line i of field "sample text"
end repeat
end mouseUp
Now I would like to insert "some text" before each line as it is printed in the screen. Since I just learned that, when I want to address the lines of text as they are formatted on the screen, I use "the formattedText of", and so I changed the above script to:
on mouseUp
repeat with i = 1 to the number of lines in field "sample text"
put "Some text. " before line i of the formattedText of field "sample text"
end repeat
end mouseUp
But this gives an error, not specifying what I did or thought wrong.
Could anyone provide an insight, please? Thanks.
Regards
I have worked through the "Working with text" tutorial. When it comes to inserting text, the following code snipped is provided:
on mouseUp
repeat with i = 1 to the number of lines in field "sample text"
put "Some text. " before line i of field "sample text"
end repeat
end mouseUp
Now I would like to insert "some text" before each line as it is printed in the screen. Since I just learned that, when I want to address the lines of text as they are formatted on the screen, I use "the formattedText of", and so I changed the above script to:
on mouseUp
repeat with i = 1 to the number of lines in field "sample text"
put "Some text. " before line i of the formattedText of field "sample text"
end repeat
end mouseUp
But this gives an error, not specifying what I did or thought wrong.
Could anyone provide an insight, please? Thanks.
Regards