[OS X TeX] Form Documents

Curtis Clifton curt.clifton at mac.com
Mon May 23 16:04:30 EDT 2005


Bob,

This is an interesting project.  I've been thinking about it a bit 
more...

On May 23, 2005, at 2:16 PM, Bob Kerstetter wrote:

> On May 23, 2005, at 1:33 PM, Curtis Clifton wrote:
>
> Hello Curtis,
>
>> On May 23, 2005, at 12:41 PM, Bob Kerstetter wrote:
>>
>>
>>> Hi,
>>>
>>> For 10 years we have been using Word and VBA to generate form 
>>> documents. We enter name, address, etc for one person, then use that 
>>> information to generate 24 different documents, each one customized 
>>> with the name, address, etc. for the one person.
>>>
>>> Is there some way of doing this with TeX, LaTeX, ConTeXt so:
>>>
>>> 1. The users have a Mac-like dialog box where they can tab forward, 
>>> backward, etc to enter the information about the person, then press 
>>> OK to create the 24 docs.
>>>
>>> 2. The user can do as number 1, but then select from a list the docs 
>>> they want to create.
>>>
>>
>> Items 1 and 2 could be accomplished without much difficulty using 
>> AppleScript with an AppleScript Studio interface.
>
> Thanks. I'll look into this. Just bought Goodman's PDF book on 
> AppleScript a month or so ago, but have not had a chance to look at 
> it. This is now a chance. ;)

It might work nicely to have the AppleScript create a new folder for 
all the documents.  It could then just copy all the required document 
sources into that directory.  For the info about the person, you might 
have the script generate a separate LaTeX file that defines commands.  
Something like:

\newcommand{\personsFirstName}{Jane}
\newcommand{\personsLastName}{Doe}
etc.

This "definitions" file could then be \input in the preamble of each of 
your document sources.  Within the sources you would just use the 
commands, like \personsFirstName.  With this architecture your 
AppleScript wouldn't have to edit the document sources at all, a task 
that AppleScript isn't well suited for.  This also lets you use a 
default definitions file when developing your template documents.

You'll probably need to use AppleScript's "do shell script" command to 
invoke the typesetting engine on the document sources.

> [snip] We are pretty frustrated right now because Word 2004 will not 
> consistently run our VBA frontend for these docs. They've worked 
> without mods for the last eight or so years on Windows and Mac (8.6 
> and 9.2) versions of Word. The frontend is very simple and does 
> nothing cute.  Actually, it will still run when stepping (F8-ing) 
> through the commands in the VBA editor, but it crashes reliably and 
> consistently when just running the macros. Maybe a 1.8 GHz G5 iMac is 
> too much horsepower for an "aging" VBA engine? Could that be? I don't 
> know. We've tried building in delays for the I/O, but that does not 
> help.

Technically, that seems unlikely.  But I've seen stranger things.  No 
other explanation comes readily to mind, but it's been 6 years since I 
touched VBA.

> BTW, in defense of my integrity, I've probably stated on this list 
> that I don't program. I don't. I hack at BASIC and a teeny tiny bit at 
> AppleScript, plus a Perl CGI or two in a previous job. But I don't 
> remember things from one project to the next. I don't do it enough to 
> remember.

I hear you.  And every language is just similar enough and just 
different enough for ones intuition to lead one astray.  I hack code 
all day, but switching to a language that I haven't used in awhile is 
still a challenge.

Curt

----------------------------------
Curtis Clifton, PhD Candidate
Dept. of Computer Science, Iowa State University
http://www.cs.iastate.edu/~cclifton

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list