Incorporating WebCam Photos in Filemaker Applications

WebCamPhoto

Here’s how to add webcam photos to your Filemaker applications.

You’ll need a copy of WebCamPhoto:

WebCamPhoto on the Apple App Store

The application allows you take a photo from your webcam. It will detect any webcams you have attached to your system. You may then select one and leave it set as your preferred device. You may call the application from Applescript with a single argument which is the filename to save to once the Save button is clicked. There are keyboard shortcuts to allow quick operation.

In your Filemaker application you will need to create a field to contain the photo. I just made a simple table with a few fields.


You should have something which uniquely identifies each row.

And of course, a field to contain the photo:

I set a calculated value so we just see the thumbnail.

I also chose to keep just a reference to the images instead of bloating up the database:

You could also create a separate table which just has a single field to handle the import so you can work on it or handle any errors. Don’t forget to delete the rows in that table so you just keep one row with just the photo you’re working with at the moment so you don’t get a lot of clutter in the database.


Next create a script to take the photo.

I have a series of steps to allow the user to delete the photo or place a photo from a file or a webcam. You’re probably reading this because you have an interest in taking live photos with a webcam.

I set a variable to hold the unique filename.

I use the unique identifier field concatenated with the last and first name of the person.

We need three separate Applescript steps. Running multiple shell scripts one after the other in a single Applescript didn’t seem to work from Filemaker.

The script invokes the WebCamPhoto app and then waits for it to finish, polling once a second to see if the app is still active. Once the Save button is clicked the photo is saved to a location relative to the sandbox for the app. Apple requires apps to have a sandbox. The file will be saved in ~/Library/Containers/Michael-Ha.WebCamPhoto/Data/Documents


If you quit the application there won’t be a photo to move, so you can either check for that or suppress the error. If you close the window the application is still running with the option of re-opening the main window. Sorry, this was a requirement from Apple. I may change it so if the app is called with an argument and the window closes it just exist.

The next step makes sure we have a folder to store the photo.

And the third step moves the file from the sandbox area to our working area.

Now we just need a reference to the photo file, so we set a variable.

Note you have to precede the path with “imagemac:”

And the very last step inserts the picture into the photo field.

Next, go to the layout and select the photo field. If you don’t see it because you added the field after initially creating the table, you can just add it again. It’s actually a button control. Once you select the photo field, click on the info icon (a lowercase letter “i” in a circle).

I made mine a 150 pixel square.

Make sure the button references the photo field.

Close the info dialog and make sure the photo button is still selected.


Right click on the photo button and select “Button Setup.”

Select “Perform Script” as the Action to take and then select the script you created earlier.

Click on Exit Layout and then try it out.