Friday, November 17, 2017

#1 2017-09-23 11:49:07 pm

Beeman
Member
Registered: 2006-03-07
Posts: 72

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)

Offline

 

#2 2017-09-24 01:06:17 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5175

Re: Filemaker Pro Advanced 16 changes?

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:

Applescript:

...
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


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#3 2017-09-25 10:49:40 am

kerflooey
Member
Registered: 2011-07-07
Posts: 138

Re: Filemaker Pro Advanced 16 changes?

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.

Offline

 

#4 2017-09-25 07:09:25 pm

Beeman
Member
Registered: 2006-03-07
Posts: 72

Re: Filemaker Pro Advanced 16 changes?

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!!!

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)