FileMaker Pro scripts can be triggered in a variety of ways, such as when a database is opened, when a user clicks a button, and so forth. Through FileMaker Pro's interface, you can create scripts, and attach them to a database. In addition to supporting AppleScript interaction, FileMaker Pro also has its own internal scripting capabilities. The following example code demonstrates how to retrieve the name of every opened database. For example: tell application "FileMaker Pro" This includes any opened, but hidden databases. tell application "FileMaker Pro"ĭo menu menu item "Hide Window" of menu "Window"Ī count command may be used to determine the number of currently opened databases. The following example code demonstrates how to do this. Using this method, you can hide a database by triggering the Hide Window menu item, which can be found under the Window menu. However, FileMaker Pro will allow AppleScript to interact with its menus, with the use of the do menu command. While FileMaker Pro has a show command, it does not have a hide command. To show a database, or bring it to the front of any of other visible database windows, you may use the show command. In some cases, your database may already be opened, but may simply be hidden from view, or be behind another database. Open theDatabase for Accounts "Admin" with passwords "heroes" set theDatabase to choose file with prompt "Please locate aįileMaker Pro database file to open:" tell application "FileMaker Pro" The following example code demonstrates how to open a single database with a specified account name and password. If multiple databases are to be opened, then a list of databases, along with a list of account names and passwords, may be passed to the open command as parameters. These parameters are pluralized because the open command may also be used to open one or more database files. When using the open command, you may optionally specify values for the Accounts and passwords parameters, if the database requires an account name and password. This is done by using the open command, followed by the path to the database file that you want to open. If the desired database is not opened, then you may need to write code to open it. This can be done by first checking to see if the database exists, as demonstrated by the following example code. When scripting FileMaker Pro, the first thing you will probably want to do, is make sure that your target database is opened. The first thing we will discuss, is general database interaction. You may download a copy of this database from This example database is password protected with an account name of Admin and a password of heroes. Therefore, some of the AppleScript terminology discussed, may not function with older versions of FileMaker.Ī FileMaker Pro database, named Super Heroes, is referenced throughout this month's column. This month, we are going to continue discussing data storage and access, this time, using FileMaker Pro, a third-party commercial database application.įor the purposes of following along with this month's column, if you do not own FileMaker Pro, you can download a fully functional 30-day trial from Īll AppleScript code covered in this month's column was written and tested with FileMaker Pro version 8.0.1. Another column explored methods of storing and accessing data in script properties and property list files. One column provided an introduction to Database Events, a background application in Mac OS X 10.4 and higher, which allows AppleScripts to interact directly with SQLite databases for the purposes of storing and accessing data.
0 Comments
Leave a Reply. |