Feedback on FileMaker Behavior with Preview

Hi everybody,

regarding the behavior of FileMaker when interacting with the Preview application. Specifically, I have observed that FileMaker does not always respond appropriately when Preview encounters an error while attempting to open a file.

Issue Description:

  1. When attempting to open a file using Preview, if the file cannot be opened (due to corruption or other issues), FileMaker does not always recognize this situation.
  2. Instead of acknowledging the error reported by Preview, FileMaker simply informs the user that the file is damaged without further details.
  3. As a result, there is no clear indication within FileMaker whether the file was successfully opened by Preview or if an error occurred.

Desired Behavior:

It would be beneficial if FileMaker could detect and respond to errors reported by Preview more effectively.

Thank You

Massimo

Are we talking about preview mode or the Mac OS Preview application or something else?

1 Like

Preview Application Only
Thank you

I assume you are creating or exporting a file with the option to automatically open the file. In this case, FileMaker does not interact with Preview nor does Preview have any knowledge that FileMaker created the file.

FileMaker sends an open file event to the operating system after it creates the file. The operating system opens the preferred application for the file type, then sends it an open file event for the file. The application communicates any error to the user and things stop there.

Communication between FileMaker and Preview is possible via AppleScript. The code's workflow, here, would look something like this:

  • Create the file from FileMaker;
  • Run an AppleScript script from FileMaker that tells Preview to open the file;
  • Have AppleScript handle any Preview error;
  • Have AppleScript tell FileMaker to display whatever error text you want.

Hope this helps!

4 Likes

Thank you,

I understand your idea. However, it is not easy for me to handle this strategy because my competence is not strong enough yet.

This situation arises because I have a container where users are required to upload only PDF files. It is possible that someone, by mistake, uploads a different file or that the PDF uploaded is damaged. My goal is to check if the file is correct and suitable as a PDF. The approach I considered is to open it using a script in the Preview application. However, the error during the opening process is not detected by FileMaker because it is outside its scope.

Do you have any other tips to avoid this process and achieve the desired result?

Thank you.

You can check the file type by looking at the file name's extension during import (or insert). FileMaker can't know if the file is damaged or whether the extension matches the file's content. That is outside of FileMaker's capabilities.

2 Likes

Ok, I'll work on the instructions for the users :sweat_smile:
Thank you for your support

Preview will open images as well as PDF so you need to verify the type. Getting the extension from the file name is probably enough.

If you use applescript you can trap the error and return them to a global for analysis.

3 Likes

@bdbd said: >You can check the file type by looking at the file name's extension during import (or insert).

This is one of the methods I use, @Massimo . In one particular use-case the user (photographer) insert photos for use in laboratory reports. They work with Photoshop files (.psd file extension) before saving as JPEGs. We have a calculated field which stores the attribute of the file name, and if the technician forgot to save it as a JPEG ( extension of .jpg) they are warned and (in some cases) the file is removed from the container field.

We also match the file name to the laboratory serial ID to make sure they are inserting the correct image. :slightly_smiling_face:

3 Likes