Let’s take a look again at our script:
tell application "FileMaker Pro" tell database "Contact Management" tell table 1 tell record 1 set firstName to field "First Name" set lastName to field "Last Name" end tell end tell end tell end tell set fullName to firstName & " " & lastName
In line 1, we have our tell statement. We’re telling FileMaker to do something for us. In line 2, we’re telling table 1 that we want it to do some work for us. You need to be careful here because you need to identify the proper table number. Fortunately, you can also identify tables by name. When you create a new table in FileMaker, you provide a name for that table. You can use this name to access it’s data via AppleScript. In line 3, we tell record 1 of table 1 that we want it’s data. Record 1 is the first record of potentially many records in the database. Within each record, we find several fields. Each of these fields contain data that we want to access. Like tables, we can access field names by name. Here, we access the “First Name” and “Last Name” fields and set them to variables. (Remember, variables are like temporary boxes that hold data.) After ending our tell statements, we create a simple concatenation of record 1’s first name and last name into a third variable identified as fullName.
Now that we have record 1’s fullName, what can we do with it? We can push it to Word or Mail or iCal or any other scriptable application. In my next post, I’ll show you how to push this data to Word.
Leave a Reply