Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using AppleScript from within FM7

Featured Replies

  • Newbies

I'm in need of a little help in translating the AppleScripts I used with FM6 to FM7.

In FM6, I used a FileMaker script that looped through the records of a database and performed an AppleScript on each record. This AppleScript would set variables to the data of various fields, and these variables would be used to tell other applications to do something. For example:

tell application "FileMaker Pro"

tell database "test.fp5"

tell current record

set myVariable to get data of cell "test data"

end tell

end tell

end tell

tell application "Finder"

--do something

end tell

This approach is no longer working for me in FM7. I've tried writing scripts in ScriptMaker that take the new structure of FM7 into account, and these work fine from within ScriptMaker. I can also do something like:

tell application "FileMaker Pro"

tell window 1

tell current record

set myVariable to get data of cell "test data"

end tell

end tell

end tell

However, I haven't been able to work out how to get at data from tables other than the current table from WITHIN FileMaker.

Any and all tips and suggestions gratefully received.

Tom

FileMaker Version: 7

Platform: Mac OS X Panther

set myVariable to get data of cell "test data" of table "test"

or

tell table "test"

tell current record

set myVariable to get data of cell "test data"

end tell...

  • Author
  • Newbies

Sorry, all I get using this method is "Object not found (Error -1728)".

Tom

I do it this way ???

set myVariable to cell "test data" of layout "test"

you must have a cell "test data" on a layout "test", but on my database, it works fine.

  • 3 months later...
  • Newbies

I have gotten the "object not found" error several times. So far it has always been because the field I am trying to access is not included in the current layout.

I have also had more problems with version 7. I tried several experiments; see the attachments. Uncomment whichever script "tell block" you want to try, and comment the active one. There's several ways that work; and a few that don't.

SetFieldsonLayouts.zip

This has been discussed at length on another list. One basic distinction is between using tables vs windows/layouts. If you want to loop through records, do finds, etc. you need to use window and layout references. But with table references, you can do everything wth NO dependence on layouts.

A table reference is a reference to the graph. It has NO connection to layouts or windows and therefore any attempt to refer to layouts, windows when using a table reference will fail. Because it has no connection to a window, there is no such thing as a found set or current record. A table does not have to have a layout connected to it. As usual with FM7 table really means table occurrence; you cannot refer to a "real" table by name.

So if you want to loop through a set of records using a table reference you must first do something like collect a list of record IDs with a "whose" clause.

ID of every record of table "People" whose cell "City" of table "People" = "Seattle"

Or use a relationship:

ID of every record of table "SalesReps" whose cell "People::City" = "Seattle"

Here's an example:

tell application "FileMaker Developer"

set tableX to a reference to table "ContactsTO" of database "Interface"

set FirstName to a reference to cell "FirstName" of tableX

set recRef to a reference to (every record of tableX whose FirstName = "Sam")

set data cell "LastName" of recRef to "Johnson"

-- result: all "Sam" records get Johnson as their last name

end tell

If you are using window type references you must refer to layouts.

tell app "FileMaker Developer"

get current record of layout "Data Entry" of window 1 of database "MyDB"

get cell "FirstName" of current record of layout "Data Entry" of window 1 of database "MyDB"

end tell

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.