Appleworks page issue
Appleworks page issue
- Subject: Appleworks page issue
- From: John Fowler <email@hidden>
- Date: Sun, 20 Jul 2003 00:29:45 -0500
I use AppleScript to parse formatted text files into a database. Each
text file consists of one or more formatted notes. I take each note
and put it in its own database entry along with certain index
information in different fields.
In order to parse each note, I need to identify the beginning and the
end. I have been using the page concept in AppleWorks to cut the
document into pages. I am sure there might be ways to do this with
BBEdit or with AS internal text processing, but I want to leverage
AppleWorks' document model rather than exploring hidden characters and
parsing them - i.e. avoid reinventing the wheel.
Occasionally a blank page occurs in the middle of my document. This
occurs because of imprecisions in the way MacLinkPlus translates
documents which begin life as Windows WordPerfect 5.1 documents into
AppleWorks documents, or because the page settings leave one carriage
return past the end of a page.
The following code works until a blank page is encountered. Following
a blank page every page thereafter results in the "exception" block
being processed. PS All the following is within a "tell app
Appleworks" block.
set pagecount to page index of last paragraph of document 1
display dialog pagecount
repeat with n from 1 to pagecount
--display dialog "n is " & n
set thepars to (every paragraph of document 1 whose page index is n)
if thepars is not {} then
if item 1 of thepars contains "LOG" then
display dialog "LOG"
else
display dialog "with n of " & n & ", item 1 of pars is " & (item 1
of thepars)
end if
else
display dialog "exception"
end if
(*This works but is commented out for debugging.
set mydata to my getinfo(thepars)
set names to my getEveryTextItem(nm of mydata, " ")
set nameslength to length of names
my makeNewEncnote({item nameslength of names, item 1 of names, "",
"", txt of mydata, dt of mydata, notetype of mydata, "", nbr of mydata,
""})
*)
--set thispage to thepars as text
end repeat
To me this means that the blank pages, which contain no information,
are somehow making every subsequent page appear to be null. This
results in the ensuing pages being unprocessable. If I implement with
this bug several "notes" will not be parsed, at the end of documents
containing a "blank" page.
I hope I've described my problem adequately, though it's probably
confusing to read this.
Can anybody suggest what the problem is, and a workaround or preferably
a foolproof solution? Thanks.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.