Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6787 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi folks!

Problem: I need to import JPGs into a container field using a calculation to set the filename to import. Is this possible.

Hope someone out there can help, this one has got me scratching my head a bit.

I have created a database to import emails containing values posted from a web form processed by a php form processor. One of the values in the email contains the filename (i.e richard.jpg) of a file that also gets uploaded/attatched to the email from the web form.

I have setup an applescript used by Mail to save down the email attachment to a specified folder. Is there anyway to script in filemaker the ability to import the attached jpg (bearing in mind that the filename (but not pathname) will be in imported into a filed in filemaker):)

Phew that was dificuilt to explain. Thanks in advance for any help

Posted

I'm assuming that you want to embed the jpegs into FileMaker? That they are smallish graphics, and you don't want to worry about losing the reference link when moving/deleting the actual graphic files later?

Your first sentence is not clear about this, as it uses the word "calculation" (it is possible to display a known image file using only a calculation also, but then you can't move it later, unless you change the calculation, or its parts). You also say "specified folder." But does that mean that the pictures stay there forever after? In which case you could Insert them in FileMaker as a reference only, or simply display them via a calculation (my preference). But maybe you want to embed anyway?

If embed: First, you should probably upgrade to FileMaker 8, as it adds file path capability, using script Variables. But it can be done in FileMaker 7, just a bit more tedious.

The method is what I call the "switcheroo" (and I'm glad to no longer often need it). In 7 you can only import/insert from a fixed file path. So you have to take your file, rename/move it to that fixed path, call a FileMaker script to Insert Picture (fixed path), then either rename/move it back, or delete it.

In FileMaker 8 you'd just set the picture path into a script Variable, then use that in the Insert dialog. In either case you need to convert the Mac path to a FileMaker path; not difficult.

Posted

Hi fenton, thanks for the suggestion. I do also have a copy of FM 8 pro. Reading back through my first post, I guess I didn't make myself that clear... bit of a difficuilt one to explain.

I do indeed want to embed the graphics into my database. I am trying to create this solution as a print production workflow, for use with a digital press.

I am not too concerned if the images are moved around as I they will be copies anyway.

When I mentioned the word "calculation" earlier I meant that because I am importing the filename of the graphic into a field in the databse I reasoned that it might be possible to create a script/calculation to import the file into a container field.

Is it possible to say set a path to a folder that all the images get dumped into and pass the variable (filename.jpg) to the import image function???

thanks for your help

Richard.

Posted

I'm still a little confused when you say "embed" and "print production workflow". I thought the latter implied that you would use the original files for printing; which implies that the database would know where they were. I suppose you could print them out of FileMaker, but I'd want to check what the result looked like. I'm not much of a "print" guy, so feel free to ignore the above.

You know, don't you, that embed means "put the whole darn picture" in FileMaker, and no longer has ANY connection to the original file?

There are various ways to get the paths of all the files in a folder, using AppleScript. Probably the easiest method is to just use FileMaker's Import Folder step. It has a dialog where you can put a script Variable as the path. It can import, embed, create a thumbnail, and get the file name of a folder, incl. nested folders.

Posted

Hi again Fenton

I am intrigued by this Import Folder step. You say that it will allow you to put script vairables in as the path how exactly does this work...?

For example if I have a relative path of file:attachment/ and the field in filemaker that contains the image name that I want to import is "Image" in the customers table I figured that by specifying "file:attachment/[customers::Image]" in the script that that might work... alas not it just says there is a problem with the path. What would the correct syntax be for this?? does it work like that or am I barking up the wrong tree?

Posted

It does not take much for a file path to be incorrect. You should create a calculation, with text result. Put it on the layout.* Is it a relative path you're doing? Do you need an absolute path instead (filemac:/)? Is the extension on the file name? Do you have any Mac colons instead of slashes in the folder path?

*In fact you can create a filepath calculation, with the result "Container", and it should show your image.

I usually put the entire filepath in the Variable, ie.,

$$file_path = "file:some folder/some file.ext"

Then, in the Import dialog, just put (no quotes):)

$$file_path

For Import Folder, you'd want a folder path, ending with a /; otherwise the same. One thing that is a little annoying is that it's difficult to set up the Import Order when you use Variables; because there's nothing there when you're setting up the script. It's best to set those up with a real folder (or file) first.

Posted

Set Variable is a new script step in FileMaker 8, at the bottom of the top Control section. You just give it a name, with either 1 or 2 dollar signs (local or global, read what this means in the dialog itself). Then you either type or click Specify to put in the value. Specify opens a standard calculation dialog. The result can be many things, but in this case Text.

Then, in any of those dialogs where you have that "file path" box (Import, Export, Insert, etc.), you just type in the name of your variable directly (no quotes). Either type your "prefix" there (file:, image:, imagemac:/, etc.), or add it during the calculation (my preference). That box is NOT a calculation box, hence no quotes, no ampersands, etc.; just type.

You can read about this in the FileMaker 8 Help. Also, why don't you update your profile here to say FileMaker 8? It's going to confuse people when you say 7 and we're talking 8-only features.

Posted

Thanks for all your help Fenton. I created a new calculation field with the result as a container. I eventually figured out how to do this. I calculated the the path and filename and it showed the image in the container horrah!

I did notice that if I move the file in finder the image disappears so it is only storing a reference. How would I get it to actually embed the image into the container (remembering that I am using a calculation field to actually show the image in the container.

Posted

Well, "embedding" is an actual operation. So you have to run a script step, Insert Picture in this case. If you were able to see the image using a calculation, then you know that you've got the path calculation correct. So just copy/paste that calculation into the Specify calculation box for the Set Variable script step. Then type the variable's name into the Insert Picture dialog.

(P.S. Be sure to uncheck "Store only a reference")

This topic is 6787 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.