I'm having problems getting the field values out of a Bento database using Applescript:

I'mn using the following code to get at the entries but I'm not able to get at the cells or fields associated with the entries. Can anyone point me in the right direction:

tell application "Bento"
repeat with i from 1 to count of libraries
    set theName to name of library i
    log theName
    if theName is equal to "Reconnaissance site report" then
        log "The library has been found"
        set theLibraryProperties to properties of library i
        log theLibraryProperties
        tell library i
            repeat with j from 1 to count of entries
                set theEntryName to id of entry j
                set theEntryProperties to properties of entry j
                log theEntryName
                log theEntryProperties
            end repeat
        end tell
    end if
end repeat
end tell
  • Have you tried setting the field before reading entries? It looks like both fall under source_items? I may have been hasty in my answer that it's not possible - it could be a syntax or logical error in getting to the data.
    – bmike
    Jul 16, 2011 at 21:12

2 Answers 2


Bento's scripting dictionary is pretty thin. It looks like field, entries and cells all are in the Bento 3 scripting dictionary - so it's hard to tell if they have been there all along or are added for future use.

enter image description here

I'm not really skilled at debugging AppleScript so I can't see any errors with the code you posted.

Have you tried looping over _source_items_ for fields and cells? The dictionary seems to indicate that the data lies there and not as easily accessed from a collection. That and a lot of logging might make up for the lack of an interactive tool to query the scripting bridge.

Scripting is a feature differentiator between Bento and the more full featured Filemaker product from the same people.

Have you tried using sqlite3 to just read the database at ~/Library/Application\ Support/Bento/bento.bentodb/Contents/Resources/Database ?

The schema and tables are all open to whatever SQL tool you like. I hope it's just a matter of constructing the right query if you prefer AppleScript (and there is a lot to prefer about it over command line scripting).

  • Thanks @bmike. Do you know why fields and entries are in the Bento 4 Applescript Dictionary if you can't access the information. I have previously tried to access the database using Applescript although to date with little success.
    – Ian Turner
    Jul 16, 2011 at 20:45
  • Ian - great question. I may have been hasty to say it's not even possible. I've edited the answer and poked a bit - I hope you get this working - it would be a nice trick getting that much use out of bento!
    – bmike
    Jul 16, 2011 at 21:26

Bike has some good advice there, but i'll add some hopefully usefull information.

The library/collection you selected, each of the fields in the library should be stored in the 'fields' property of the library.

As you iterate over the entries, each entry contains a cells collection where the name of each cell matches the name of the fields in the fields collection

Set myValue to cell "field name" of entry j

Sorry, I can't post any real code atm, writing from the iPad.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .