Using Applescript to start FM and open a DB
Here is a bit of a challenge in integration. We are using a headless mac mini to drive many automation functions for custom production management DB. Occassionally, FM shuts down, the server will crash (rarely) or some remote mount will break connection. While all of these external factors are factors in why we would choose to restart FM on the Mini, they are coincident to what happens, WHEN we attempt to restart or recover normal operations.
I have pulled my hair out on this and am probably missing a simpler solution so.. if anyone has set up something to "recover" or restart a database that is hosted on a Filemaker Server via applescript, I would certainly appreciate you lending me your support. Here is more...
In the case of a power outage on the client, I have created a startup script in applescript to mount the server volumes and restart FM. What is interesting comes next as I cannot seem to join the two processes together without creating a timeout due to something odd.
Here is the script ....
tellapplication "FileMaker Pro Advanced"
do script "[PROCESS] Start Timer Script"
Running this script in .app form causes the filemaker icon to bounce in the dock until the applescript app times out. If you click the item in the dock, the app continues to completion..
If, however, your run the script that made the app file from the script editor (applescript editor), then.. it works flawlessly.
The UI Scripting stuff in Mountain Lion seems to be failing as well, as I tried to call the dock process to get the FM Pro object selected using UI Elements scripting... even though documentation says you can do it, you obviously cannot as Applescript doesn't recognize the "Dock" process of the "Finder" application.