Filemaker Pro Advanced 16 changes?

Hello,

I have been running the following AppleScript from within Filemaker Pro 13 using the “Perform AppleScript” step to delete old backups the current filemaker database file. It has always worked well.

tell application “FileMaker Pro Advanced”
tell table “Preferences”
tell record 1
set bakFolder to cell “_cMyFolder_AS” & “clientbackups:”
set currentFileExtnsion to cell “ToBurnSound” as text

		-- gwarn is a setting in Filemaker Pro database to know how much feedback the user wants
		set gwarn to cell "gwarned" as number
	end tell
end tell

end tell

tell application “Finder”
set delete_old_files to alias bakFolder
delete (items of delete_old_files whose ((creation date < (current date) - (60 * days)) and (name extension is currentFileExtnsion)))
end tell

However after upgrading to Filemaker Pro Advanced 16 I am getting the following errors

Filemaker Pro Advanced got an error: A privilege violation occurred

unknown error: -10004

Anyone have an idea what is going wrong? The Filemaker script is running with full access privileges

Browser: Safari 602.3.12
Operating System: Mac OS X (10.12.5)

My guess is that the problem is with current date. That’s a scripting addition command, and these days you are not supposed to call them within an application tell block.

Try something like this:

...
set cutOffDate to (current date) - (60 * days)
tell application "Finder"
    set delete_old_files to alias bakFolder
    delete (items of delete_old_files whose ((creation date < cutOffDate) and (name extension is currentFileExtnsion)))
end tell

A scourge of Filemaker Pro 16 is the new policy of turning OFF Applescript privileges by default. I believe this means that you will need to go into Manage Security for this database and explicitly check the “Allow Apple Events” checkbox, even if user accounts say they have “Full Access.” Furthermore, you will have to do this for each and every database which uses Applescript.

Shane

Thank you for the script tip!

It turned out that kerflooey was correct. I needed to turn on the “allow Apple events”. This made the script work. This is not intuitive at all!!!