Getting field data from a Bento database using Applescript 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
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.



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