Thanks for all the useful info peppered throughout these list archives.
I’m stumped though on one aspect of handling Filemaker container fields in Applescript and haven’t been able to find any answers searching here or any other Filemaker info spots on the net.
I have a large serially-connected, collection of scripts interacting with several programs to manipulate the contents of a constantly growing, extremely large respository of image files. At the end of this chain, I store the images in Filemaker container fields - in addition to their being out on disk in the file system visible from the Finder, of course. It’s quite a complex workflow chain - one I’m not anxious to meddle with.
Now, I have no trouble getting my images into the container field in a FMP record. All you need is a VALID alias and a piece of AS such as:
tell application "Filmaker Pro" set cell 'image' of current record of document theDtbTableName to (alias theValidFilePath) end tell
I specify above the or spec must be VALID, because Filemaker won’t allow you to add file path to a container field, if there isn’t already there on the disk. There are many reasons why - especially within the context of creating an automated workflow pipeline such as this - that you need to do just this. This validation “feature” of container fields is not documented at all. In fact, container fields are very poorly documented in general.
Back to the problem at hand. You can also get the contents of this container field out - the actual image file content out again with the following line of AS:
tell application "Filmaker Pro" copy cellValue of cell of current record of document theDtbTableName end tell
Here’s where I’m stuck.
I didn’t think ahead of time to have a separate field for storing the filename and/or path of the image file I’m storing in Filemaker, but I now need to get that information out of Filemaker in order to pass the images on to other image processing programs for further action. I’d simply add such a field to the database, but the Applescript code handling files on there way through this workflow pipeline is quite complex, and I’d rather not have to go in a modify it. There’s also the issue of the 100,000s of records already in the database. I can’t easily run them back through a modified pipeline JUST to get a file path which, as I explain below, is already stored in the Filemaker database file.
The reason I didn’t orignally store this info was because I thought it was already being stored by Filemaker. This is, in fact, true. First of all, as I mentioned above, before you store a file in a container field, Filemaker first verifies the or object you give it, making certain the file actually exists before it lets you store it in the database. I think this is a major failing of the container mechanism in Filemaker. Most major Relational Database Management Systems (RDBMS) have more flexible mechanisms for storing such binary objects enabling you to store anticipatory information about a binary file you intend to create later. It doesn’t have to already exist out in the file system.
So - anyway - clearly, Filemaker was processing the or specification, and I thought this might mean it was actually storing this information, too. There was an addition reason I had for thinking this. After storing an image file in a container field, if you place that field in a Filemaker visual layout, then Filemaker will render the image content in the layout as you browse through the records in the database. If you then go out and delete the images files from disk and go back and look at the database layout, the container field now is blanked out and shows some indication the original file content no longer exists.
This clearly indicates Filemaker must store the file specification, in order for it to go out to the file system and grab the file content to render within the database layout. It also needs the spec, if it is to determine when the file has been deleted from disk.
Finally, if you use the brute force method of opening such a Filemeker database in a text editor such as BBEdit, you’ll see the actually file paths tucked in with a lot of gobblediegook, since these database files are really binary files that happen to store some of their information as ASCII text.
Does anyone know how I might access a container value’s file spec info from Applescript? As I say, the info is there, but I can’t find any verbs or objects in Applescript that can get me to it. As I mention above, Filemaker’s Applescript documentation is pretty slim, as is it’s documentation on container fields. The documentation on the combined topic of Applescripting Filemaker container fields is virtually non-existent. It took me a while just to get me where I am now - able to add data to a container field. There is ABSOLUTELY NO DOCUMENTATION ANYWHERE saying you can’t add a well-formed file alias to a container field, if the file doesn’t actually exist. That one alone took me nearly entire day to figure out, some time back.
Many thanks ahead of time for any helpful info you can offer.
Laboratory for Biological and Anatomical Informatics
Department of Neurobiology & Anatomy
Drexel U. College of Medicine