July 5, 201213 yr I am using Filemaker Pro 8.5 (MacOS 10.4.11) which for various reasons I am not in a position to upgrade at present. I have created a simple database of only one table. My purpose, which I have successfully achieved, is to manipulate and output data from this database (which only I use) as a set of 50 textfiles. The fields in the database include: category_number export_text I have a set of 50 scripts, named 1 to 50, each in the following form, plus a script called "PerformAll" which calls all 50 scripts one after the other. Each of the 50 scripts contains only the following: Perform Find [Restore] Sort Records [Restore; no dialog] Export Records [No dialog;"filename";Unicode (UTF-8)] The "Perform Find" step searches for a specific value in the field 'category_number' and the "Export Records" step exports the found and sorted set as a textfile called "filename". This all works perfectly, and if I have for example 100 records in my database where the 'caegory_number' is say 8, then the file called "8" will contain 100 'paragraphs', each consisting of the content of each of the 100 'export_text' fields, each ending with a "return". WHAT I NEED TO ADD TO THESE 50 FILES IS: a single line of text added **_only once_** as the 1st line of each textfile, saying what the Category is. So, for example, category 8 might be "Houses". Excuse my ignorance, but I cannot think how to get this data to appear only once in each file! Can someone please help me? Thank you.
July 5, 201213 yr WHAT I NEED TO ADD TO THESE 50 FILES IS: a single line of text added **_only once_** as the 1st line of each textfile, saying what the Category is. One way to accomplish this would be to export as XML and use a custom XSLT stylesheet to build the exported text file. Another option is to export as you do now, and use AppleScript or a plugin to add the line to the exported file. BTW, you could replace the 50 scripts by a single one - using the category as the script parameter.
July 5, 201213 yr Author Thank you, comment. The idea of an Applescript appeals most to me. I guess what I need is a "perform Applescript" step added to the end of the FM script, which opens the file which has just been created and adds the line to the file, then closes it. Do you know enough Applescript to be able to tell me what it should look like? Thanks in anticipation. Philip
Create an account or sign in to comment