Script for double-clicking container fields?
????? I'm new to this but this kind of thing should "just work" Anyone know what I need to do?
You cannot easily script for a double click.
I would guess that you want to open the file in the container field by double clicking the field?
If so, this can only work if the following are true:
Insert File was used to insert the file and "store a reference" was selected for it. (Drag and drop in FileMaker 12 won't work for this as it is the same as Insert Picture without this option selected. It works in FileMaker 11 on Windows systems because that is the same as Insert Object--an option not supported in FileMaker 12.)
The container field layout object has not been optimized for interactive content (fileMaker 12 or newer).
The container field's storage options does not specify External Storage (FileMaker 12 or newer).
Given those issues, it may be simpler to either add a button or use button setup to configure your container field as a button that then uses Export FIeld Contents to export and then automatically open a copy of the file in the container field. This option works for all files in container fields regardless of the insertion, storage and layout data format options specified.
I seem to like the last option but I can't quite figure it out. It shows the option to open a copy of the file but it takes me to my folders to specify a file where to save it first and then open it. If it's fairly simply and you wish to assist further, let me know. I may be too new to this to figure this one out. Thanks.
There is more than one option. What exactly do you need to accomplish when you open the file? Just view it or will you then do something else with it once it is open?
Just view I would think. I really like how you can use that field with FileMaker Go. You can do just about anything you want to with it. Seems odd to me that the "full version" has less capability with the container fields. Anyway, I'd like to be able to drag and drop into with a new document, pic etc., and then view it if need be. Thanks. Oh, delete it and replace it if necessary.
Please note that drag and drop physically embeds a copy of the file into the container field and is functionally the same as selecting Insert Picture from the insert menu.
You'll need to decide whether or not to specify external storage for this container field as well.
Here's a simple script that opens the contents of a container field by exporting it to the temporary folder:
Set Variable [$Path ; Value: Get ( TemporaryPath ) & "FileName.Extension" ]
Export Field Contents [ YourTable::YourContainerField ; “$Path” ; automatically Open ]
The filename can be extracted from the container field as long as secure external storage is not specified. See the following thread for info on the needed calculation and to learn more about path variables, container fields and script steps that can use a path variable: Exploring the use of a $Path Variable in Scripts
I'll try that and let you know. Thank you.
It's not working. Did I do it wrong? Looks right to me.
You have to replace the text "filename.Extension" with an actual file name and an actual file extension. If all your files are of a given file type--say they are all PDF's then you could use something like:
Get ( TemporaryPath ) and "file.PDF" )
and you'll get a PDF to open with your OS default reader and you'll see that the document is named "file.PDF". But I also mentioned that you can extract the name of the original file and use it in this expression. The link I posted takes you to a demo file that you can download that includes a calculation that can extract the file name from a container field so long as it does not have the secure, external storage option.
I'm pretty sure I can make this happen. Thank you!
And I have since updated that file so that the calculation now works with external, secure storage fields as well as other options.
Man, I've tried everything and mirrored what was in the link and logic associated with it and still can't get it. I can get it to work with "Insert File" but that's it. I tried to trick it by inserting a file but it was a jpg and it didn't work at all. I am pretty sure that I tried everything in all the links and posts.
Why insert file instead of export field contents?
"it didn't work" doesn't tell me what happened when you tried to get it to work--that often provides a clue as to what should be done differently.
You should post the script that didn't work for you as I may be able to spot what needs to be changed from the posted script.
Hmm... I'll check it out and let you know. Thanks!
It seems that the Export Field Contents is going to work best. Thanks.
Retrieving data ...