Here is a repeat that I have. I want it to go through each line of a text, which it does it fine. But, after a delay of 1 second, I want it to go through each line again, but start where it left off. So, right now, it will read the first number of avaiable lines. One second later I want it to do the same if there are new lines present. Any ideas?
set talking1 to value of text area 1 of scroll area 1 of window myAnswer
set x to number of paragraphs of talking1
set y to 1
repeat with i from 1 to x
say paragraph y of talking1 using "victoria"
set y to y + 1
end repeat
You don’t need the “y”; you’ve got i.
" say paragraph i of … "
At the end of the “say” repeat, save the value of the old count in a variable, drop out of that repeat into an enclosing repeat, wait for a delay, recount the text, then start your inner repeat with the old count running to the new value of the count:
Adam, it seems like this would work. But, It is showing an error. Ithink it sees OldCount and NewCount as the same number, Does this look right to you?
set OldCount to number of paragraphs of text area 1 of scroll area 1 of window "chat with chandler"
repeat
delay 3
set NewCount to number of paragraphs of text area 1 of scroll area 1 of window 1
repeat with i from OldCount to NewCount
say paragraph i using "victoria"
end repeat
end repeat
For openers, BD; you haven’t given yourself a way out of the outer loop.
This is what I meant before:
set TextSoFar to number of paragraphs of text area 1 of scroll area 1 of window "chat with chandler"
set OldCount to 1
repeat
repeat with k from OldCount to TextSoFar
say paragraph k using "victoria"
end repeat
set OldCount to TextSoFar
delay 3
set TextSoFar to number of paragraphs of text area 1 of scroll area 1 of window "chat with chandler"
-- do something so you can get out, but if you run this in the Script Editor, just force quit.
end repeat