MightyData

FileMaker and WordPress Consultants

  • Company
    • About
    • Contact
    • Team
    • Artists
  • Services
    • Consulting
    • Development
    • Our Process
    • Coaching
    • Training
  • Results
    • Customers
    • Success Stories
    • Testimonials
  • Blog

Image Rotation and FileMaker

April 19, 2011 by Anders Monsen 3 Comments

Script to call AppleScript from FileMaker

Recently I was asked whether it is possible to rotate an image in a FileMaker container field. As far as I know this only is possible by exporting the image, using another application to rotate the image, and then re-importing it back into FileMaker. This solution would exist only in a Mac OS X environment, so I turned to AppleScript, and the built-in image manipulation app called Image Events.

Although I am sure refinements can be made to the process, and it currently only works on the Mac OS, the process is fairly straightforward. The file has a container field which stores an image. Another field stores the temporary path for each record’s image. I decided to capture the direction of the rotation (clockwise or counter-clockwise) as a script parameter and set up some basic buttons to handle the process for the demo. To rotate clockwise the angle is 90 degrees, while for counter-clockwise it’s 270 degrees.

Script to call AppleScript from FileMaker

Since the AppleScript uses the database name and layout name, I captured these as variables. I also set the AppleScript itself as a variable so I could step through the script and see what it generated. I then built the path for the export, and also converted the slashes to colons for the AppleScript path. Immediately after exporting the image, I ran it through the Image Events to rotate it, and then followed this up with an insert image script step, grabbing the rotated image from its Finder location. I added a platform check so this would run only on the Mac.

AppleScript to rotate an image

There are at least two plug-ins that accomplish very similar goals. 360Works’s free ScriptMaster rotates an image based on a URL, so if this image resides in a container field you first will need to export the image, apply the rotation with the ScriptMaster function, and import the modified image. CNS Image will actually rotate an image inside a container field, and has many other useful features; prices can be found at the CNS web site. Both plug-ins are cross-platform, unlike the AppleScript solution outlined here.

Sample File: ImageRotator.fp7

Filed Under: Scripting Tagged With: Container fields, Demo file, Integration

Dealing With Errors in FileMaker

April 5, 2011 by Anders Monsen Leave a Comment

Approaches to errors during development generally break down into two methods. Like defensive driving, the first method attempts to avoid errors from occurring. The second method attempts to deal with errors that occur and find appropriate ways to minimize the effects. Good solutions find a balance between both methods.

Typically errors occur in the context of scripting through unexpected behavior, although other areas of FileMaker can result in unexpected behavior, including case statements, conditional formatting, autosizing of layout objects, charting behavior, and security. In this brief article we’ll focus on scripting errors, although the methodology applies to all areas: test all features from as many perspectives as possible.

FileMaker Error Codes

FileMaker harbors built-in detection and notification of errors. Internally, these take the form of numerical codes, and each code bears a matching text description in FileMaker’s error reference in the Help file. Over 200 built-in error codes exist, including the “no error” error code of zero (0), and the common search result error code of 401, indicating no records were found.

Although one might believe it counter-intuitive to include these as error codes, when checking for errors such behavior, it is invaluable. They are like the Hound of the Baskervilles, which failed to bark at a critical moment and provided the clue to solve the mystery.

FileMaker’s own internal codes will spur various dialog messages. Users trying to modify a record being modified by another user will see a dialog to this effect. Scripts that modify records may run into the same issue, but with no one monitoring the script, such dialogs will pause action until they are resolved.

Trapping for Errors

By taking control of FileMaker’s error notification through the Set Error Capture [On] script step prior to actions that may cause errors, developers can plan for possible errors and deal with them below the surface, allowing scripts to ignore errors or set them aside until later.

There are various levels of handling errors that developers can use in solutions, if they accept the fact that errors are possible, even in the best of circumstances. First, suppress all or certain error notifications. Second, assuming human interaction is possible, display alerts in dialog windows to users and guide resulting action from users through the script.

This could mean requiring the user to take action based on the alerts, and handle the user’s possible action(s). In addition, developers could build in processes that log all errors in a table for subsequent debugging.

Filed Under: Scripting

  • « Previous Page
  • 1
  • 2
  • 3
  • Company
  • Services
  • Results
  • Blog

Copyright © 2026