AnsweredAssumed Answered

FileMaker hang when opening a database or triggering a script via AppleScript with display locked

Question asked by BenWaldie on Sep 14, 2012

Summary

FileMaker hang when opening a database or triggering a script via AppleScript with display locked

Product

FileMaker Pro

Version

12.x

Operating system version

Mac OS X 10.7 - 10.8

Description of the issue

Many business users utilize AppleScripts to interact with FileMaker Pro databases.  FileMaker currently requires that FileMaker be the frontmost application when an AppleScript attempts to open a database or trigger a FileMaker script.  While normally, this isn't a problem, if a screen saver has become active or the display has become locked, FileMaker cannot come to the front.  Therefore, FileMaker hangs in the background and the AppleScript will encounter an error.

Steps to reproduce the problem

On a Mac...

1. Launch System Preferences
2. Go to Desktop & Screen Saver and click the Screen Saver tab
3. Click Hot Corners and set the upper left corner to Put Display to Sleep
4. Launch AppleScript Editor and create a new script document
5. Enter the following into the script document:

delay 5
try
     with timeout of 2 seconds
          tell application "FileMaker Pro"
               activate
               getURL "fmp://1.1.1.1/DBNAME"
          end tell
     end timeout
end try
beep

NOTE: Replace 1.1.1.1 with an IP address of a database server, and DBNAME with the name of a database served by the server.

6. Run the script
7. Quickly move the mouse to the top left corner of the screen to put the display to sleep
8. Wait for the script to beep, signifying that it has finished running
9. Press a key or move the mouse to wake the display

Expected result

FileMaker Pro is in the front.

Actual result

The script is still in the front and FileMaker is bouncing in the Dock.  The "activate" command, while it may launch FileMaker Pro if it's not running, does not bring it to the front.  Hence, the database won't open.

Workaround

I am unaware of a workaround for this issue.  The same problem occurs if you attempt to bring FileMaker to the front in another manner...

delay 5
tell application "System Events" to set frontmost of process "FileMaker Pro" to true
try
     with timeout of 2 seconds
          tell application "FileMaker Pro"
               getURL "fmp://192.168.1.15/Email Archive"
          end tell
     end timeout
end try
beep

It would be great if AppleScript could instruct FileMaker to open a database and trigger FileMaker scripts without the application coming to the front.

Outcomes