Snippets Table of Contents | About Snippets | Faughnan Home Page

FileMaker Pro (Mac) Clipboard Management and AppleScript (snippet)

FileMaker Pro (Mac) can use AppleScript to move data into another Macintosh application, such as a text editor. This is the only way I've found to output save the contents of a single FileMaker field as a file on disk. I copy the contents of a FileMaker record, then paste the text into a text editor, and save the result as text file. I can do this for all records in a file.

This is a simple process, but there's one critical step. It is essential to activate the destination application, then do the paste operation, then activate FileMaker before doing another copy operation. If you fail to activate FileMaker, then FileMaker's internal clipboard will change, but the external system clipboard will not. Figuring this out was painful, I'm indebeted to Martin Trautmann for telling me how to do this.

If you'd like to dissect a FM Pro database that exports to HTML, you can download my snippets.fp3 database.

The following AppleScript code shows how this works. (Note: If you need quotes anywhere in FileMaker field, you need to use a quote as an escape character, as in "")

(the copy operation is done before this section using FileMaker's internal scripting commands)

tell application "Scriptable Text Editor"
activate
make new document at beginning
paste
save document 1 in file "Woofer:Work:WWW:Dragon:Snippets:" &
FileNameOut as text
close document 1 saving no
end tell
tell application "FileMaker Pro"
activate
end tell


Descriptors
Confidence (1 to 3): 3. Date Created: 2/19/97. Last Revised: 6/11/97. Expires: . Language: english. Domain: .world. ID: 5. Topic: computer. Subtopic: Macintosh. Keywords: programming, application, AppleScript, FMPro, FMP3, FP3, clipboard, system, exchange.


Author: John G. Faughnan.  The views and opinions expressed in this page are strictly those of the page author. Pages are updated on an irregular schedule; suggestions/fixes are welcome but they may take weeks to months to be incorporated. I reserve copyright except where noted, if you want to repost or quote a page just ask. Anyone may freely link to anything on this site and print any page; no permission is needed for linking,  printing, or distributing printed copies.