Advanced Quark

For the last couple of weeks I’ve been working on a system to take records from a FileMaker database and place the information into a Quark document. When this thing is all through, the resulting document is going to be a couple of hundred pages long.
I’ve gotten to the point where the template is opened, and information is piped through to Quark in the format needed, but it’s the next step that I need help with.
Can anyone who has done this kind of thing before give any clues as to the best way to do this? For instance, if the current listing takes up more than the available space in the text box, I want the entire listing to go into the next text box. Also, is it best to create pages based on the master and link the text boxes on them with AppleScript (can this even be done), or is it best to let AppleScript handle all of that, and make it so that none of the text boxes are linked?
If you are reading this and have worked with Quark and AppleScript for a large document, any help you can provide would be welcome. I’ve been searching on the net for about a week looking for resources to help with this, and I haven’t had any luck.
Thanks, Chuck

One question I have is: what is the best way to add text to a text box? The > method I’m currently using is: > > set text of the last paragraph to (text of the last paragraph) & headingText & > dataToTransfer
The reason I ask this is that some lines have the first few words in bold > (that’s the headingText above), but when I add a return to the line, for some > reason the entire line changes to bold. Any idea why this would be and what I > can do to prevent it?
What actually happens when you set text to itself is that the text goes to AppleScript and back, therefore it takes on the attributes of the beginning of the line. Instead try something like that:
tell text box a of page b of document c set x to make new text at end set text of x to return & “123” end tell
My next question goes back a step. It is better to use a template and open it > at the beginning of the script, or is it better to make a new document and > make all the necessary text boxes on the fly? I’m beginning to use the second > method so that I can be sure of the order of the text boxes and their names > before I do any work with them.
In my experience it is usually better to do as much of the work on templates. It is true, however, that you have to worry about the order of the boxes. The way i deal with it is that: when I’m done with my template, I start from the box I want to be the back most box (last box, box at the end…), and I bring it to FRONT (shortcut: F5). I do that to every box following that. This way, the last box I bring to the front is the box that stays on top, and the first box I brought to front is the one that is back most now. Another great utility is ScriptMaster extension. This one is a must. You can use it to record scripts in Quark, and then use pieces of recorded scripts in your other scripts. Another thing that ScriptMaster is useful for is its ability to display the box number and name on the screen. This way you can see the order of the boxes.
When using Quark templates with AppleScript, you don’t really need to save them as templates. Simply save them as normal documents, and have the script re-save them in another file. This makes them easier to change.
Also, what is the best method to have text flow from one text box to the next? > Should I use links? Is that scriptable? The method I’m using now, since a > single record should not be broken up between two text boxes, is the > following. Before I insert any information into a text box, I record the > current line number. After all the information for a record in inserted into > the text box, I check to see if “box overflows” is true. If it is, then I > delete the lines from that recorded line number to the line number (count of > lines). Then I go to the next text box (there can be two on a page), or make a > new page and go to the first text box, depending on if I’m in text box 1 of a > page or text box 2.
It sounds as if you’re on the right track here. Do you encounter problems with your method?
Having heard so many times of how useful AppleScript is in doing just this > sort of thing, I’m hoping that some of you out there can help me out. If > anyone has a working solution, even the simplest one, that can help > demonstrate to me the techniques, I would be very grateful to have them sent > to me. > > Thanks for your time. Chuck
You’re welcome. AppleScripters seem to always have time to help each other… And you are definitely doing the smart thing learning how to script. It takes time, patience and persistence, but the rewards are unimaginable. You may also want to check out the AppleScript forum at the Quark web site. It can be very useful.
Good luck,
Hanaan

I think you need to be a bit more specific as far as what you want done to the document, what kind of text flows in, what are some of the specific problems you foresee, etc.
Hanaan

: I think you need to be a bit more specific as far as what
: you want done to the document, what kind of text flows
: in, what are some of the specific problems you
: foresee, etc.
Well, I’ve got a project where data is being brought from a FileMaker database into a Quark document to create a catalog of all the records in the FileMaker database. I’m pretty new to scripting, and very new to Quark, so I’m having a lot of trouble.
So far I’ve got the script to open a Quark template and save it in a specified location (in relation to where the script is). Then I step through all of the records, and take information from each appropriate field and insert it into the text box in Quark (which is part of the template).
One question I have is: what is the best way to add text to a text box? The method I’m currently using is:
set text of the last paragraph to (text of the last paragraph) & headingText & dataToTransfer
But I’ve also used:
set the contents to the contents & return
These statements are both within a “tell text box 1 of page 1 of spread 1 of document 1” block.
The reason I ask this is that some lines have the first few words in bold (that’s the headingText above), but when I add a return to the line, for some reason the entire line changes to bold. Any idea why this would be and what I can do to prevent it?
My next question goes back a step. It is better to use a template and open it at the beginning of the script, or is it better to make a new document and make all the necessary text boxes on the fly? I’m beginning to use the second method so that I can be sure of the order of the text boxes and their names before I do any work with them.
Also, what is the best method to have text flow from one text box to the next? Should I use links? Is that scriptable? The method I’m using now, since a single record should not be broken up between two text boxes, is the following. Before I insert any information into a text box, I record the current line number. After all the information for a record in inserted into the text box, I check to see if “box overflows” is true. If it is, then I delete the lines from that recorded line number to the line number (count of lines). Then I go to the next text box (there can be two on a page), or make a new page and go to the first text box, depending on if I’m in text box 1 of a page or text box 2.
Having heard so many times of how useful AppleScript is in doing just this sort of thing, I’m hoping that some of you out there can help me out. If anyone has a working solution, even the simplest one, that can help demonstrate to me the techniques, I would be very grateful to have them sent to me.
Thanks for your time. Chuck