Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7559 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I am experiencing difficulty referencing FileMaker Pro 7 objects with AppleScript.

(I realise Apple Events support has been updated, as discussed in TechInfo article "Apple Events In FileMaker 7": http://www.filemaker.com/ti/108943.html)

For example, an AppleScript for FM7:

delete (every record of table "aTable" of database "aDatabase" whose cell "aCell" = "aValue")

This AppleScript only works if the front most window is for database "aDatabase" and a layout for table "aTable" is selected.

If the window for database "aDatabase" is hidden, not front most, or a layout for another table is selected, the result is "FileMaker Pro 7 got an error: Event not handled".

The cell reference causes the error, because a similar script works irrespective of the state of the window for database "aDatabase":

delete (every record of table "aTable" of database "aDatabase")

Question: How to successfully refer to a database > table > cell that may not be in the selected layout of the foreground window?

With thanks in advance

Jim

Version: v7.x

Platform: Mac OS X Panther

Posted

If you'r calling the AppleScript from a FileMaker script, you can use

Freeze Window

Go To Layout [...]

Show All Records

before running the AppleScript to ensure you are on the right layout and all records are in the found set.

After the AppleScript:

Go To Layout [Original Layout]

Is this The solution you needed?

Posted

I don't think this is an appropriate solution. What is the point of show all record? Normally when people are working with databases, they are trying to work with a particular data set.

set recList to ID of every record of table "aTable" of database "aDatabase" whose cell "aCell" = "aValue"

repeat with thisRec in Reclist

delete record ID thisRec of table "aTable" of database "aDatabase"

end repeat

This topic is 7559 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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