storing a Word document as a customprop
Peter Brigham MD
pmbrig at gmail.com
Fri Jun 12 08:55:51 EDT 2009
I would like to generate a Word doc stored in a customprop but I'd
like to modify it first by script. I have a template successfully
stored as the printDoc of this stack, with placeholders in applicable
places like "<last>", "<first>", etc. However, this doesn't work:
on mouseup
put fld "Name" into tName
put item 1 of tName into lastName
put word 1 of item 2 of tName into firstName
put the printDoc of this stack into tDoc
replace "<last>" with lastName in tDoc -- * problem
replace "<first>" with firstName in tDoc -- * problem
put the printPath of this stack into pPath
-- contains something like "binfile:/Users/pmbrig/Desktop/
wordTest.doc"
set the itemdelimiter to "/"
put tolower(lastName) & ".doc" into item -1 of pPath
set the filetype to "MSWDW8BN"
put tDoc into url pPath
end mouseup
I get an error from the finder that the file "doesn't appear to be a
Microsoft Word file." If I comment out the two "replace" lines in the
script, the original template file is exported fine, and it opens fine
in Word with a double-click. So there's something Word doesn't like
about the replace operation. Is there any way to do this so I create
the template document modified with data filled in from Rev?
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
More information about the use-livecode
mailing list