-- HyperReader.applescript
-- Simultaneous Stanza Reader
-- Created by Mike Bee on 6/7/09.
on clicked theObject
tell window "hyperReaderMainWindow"
set theStartingParagraph to contents of text field "startingParagraph"
set theNumberOfParagraphsToRead to contents of text field "numberOfParagraphs"
-- set contents of text field "endingParagraph" to theStartingParagraph + theNumberOfParagraphsToRead
set theFileToRead to (choose file with prompt "SELECT A TEXT FILE:")
set contents of text field "myTextFile" to theFileToRead
end tell
tell application "TextEdit"
activate
open theFileToRead
set docName to name of document 1
set selDoc to document 1
set viewDoc to (make new document)
set viewWindow to the first window
set the bounds of viewWindow to {44, 44, 1900, 980}
set x to theStartingParagraph
set y to theNumberOfParagraphsToRead
end tell
repeat y times
tell application "TextEdit"
set text of viewDoc to get paragraph (x as integer) of selDoc
set size of text of viewDoc to 150
set font of text of viewDoc to "Arial"
say (get paragraph 1 of viewDoc) using "Alex"
set x to x + 1
end tell
tell window "hyperReaderMainWindow"
set contents of text field "endingParagraph" to x
end tell
end repeat
tell application "TextEdit"
close document 2 saving no
close document 1 saving no
quit
end tell
end clicked