Is there a way of getting a certain line set by a variable and putting it into a field.
I've got the code below but it returns a compiling error:
Code: Select all
put line sVariable of URL "file:/list.txt" into field "result"
Thanks
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Code: Select all
put line sVariable of URL "file:/list.txt" into field "result"
Code: Select all
on mouseUp
put specialfolderpath("desktop") & "/testtext.txt" into tFile
put 2 into sVariable
put line sVariable of URL ("file:" & tFile)
end mouseUp
Code: Select all
on mouseUp
## Add your pathname here:
put specialfolderpath("desktop") & "/testtext.txt" into tFile
## Read the file completely!
put URL ("file:" & tFile) into tCompleteFile
## Now extract your line:
put 2 into sVariable
put line sVariable of tCompleteFile into fld "result"
## Put the number of lines into the variable tNumOfLines:
put the num of lines of tCompleteFile into tNumOfLines
end mouseUp