print #handle, "!line n string$" ;

Returns the text at line n.  In the code above, n is standing in for a literal number.  If n is less than 1 or greater than the number of lines the text window contains, then "" (an empty string) is returned.  After this command is issued, the line's text is contained in the variable string$.

This sample code retrieves the contents of line  number 7 and places them into a variable called string$:

    print #textwindow, "!line 7 string$"

print #h, "!lines countVar" ;

This command returns the number of lines in the text window, placing the value into the variable countVar. 